Skip to content

Commit

Permalink
Fix a crash that can occur when updating timeline items in a backgrou…
Browse files Browse the repository at this point in the history
…nd thread (#2268)
  • Loading branch information
nimau authored Dec 19, 2023
1 parent c7276a6 commit 8dd66d3
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ class RoomTimelineController: RoomTimelineControllerProtocol {

@objc private func contentSizeCategoryDidChange() {
// Recompute all attributed strings on content size changes -> DynamicType support
updateTimelineItems()
serialDispatchQueue.async {
self.updateTimelineItems()
}
}

private func updateTimelineItems() {
Expand Down Expand Up @@ -303,7 +305,9 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
}
}

timelineItems = newTimelineItems
DispatchQueue.main.sync {
timelineItems = newTimelineItems
}

callbacks.send(.updatedTimelineItems)
callbacks.send(.canBackPaginate(canBackPaginate))
Expand Down

0 comments on commit 8dd66d3

Please sign in to comment.