diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 3e8ec3044..a334926d1 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -1088,8 +1088,12 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro } else { - MXLogDebug(@"[RecentsViewController]: Reloading table view section %ld", indexPath.section); - [self.recentsTableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationNone]; + // Ideally we would call tableView.reloadSections, but this can lead to crashes if multiple sections need such an update and they + // vertically depend on each other. It is unclear whether this is due to further issues in the data model (e.g. data race) + // or some undocumented table view behavior. To avoid this we reload the entire table view, even if this means reloading + // multiple times for several section updates. + MXLogDebug(@"[RecentsViewController]: Reloading the entire table view due to updates in section %ld", indexPath.section); + [self refreshRecentsTable]; } } else if (!changes) diff --git a/changelog.d/6115.bugfix b/changelog.d/6115.bugfix new file mode 100644 index 000000000..6998581e3 --- /dev/null +++ b/changelog.d/6115.bugfix @@ -0,0 +1 @@ +Search: Prevent crash when searching