Commit c87ab7a7 authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

Fix RL crash when modifyed in background scene.

If the RL view is in background scene when the model is modified,
reloadData is called, and the number of items is updated, but rendering
is postponed until the screen is displayed.
If the model is modified again before that, it is possible that the
view access items that have been deleted since.

Bug: 1097027
Change-Id: Ibbd4d19700cf86bfda9db4ddb4d2285203f5ce0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2428966Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811200}
parent 9a583fa4
......@@ -975,6 +975,12 @@ ReadingListSelectionState GetSelectionStateForSelectedCounts(
// Called when the table is empty.
- (void)tableIsEmpty {
// It is necessary to reloadData now, before modifying the view which will
// force a layout.
// If the window is not displayed (e.g. in an inactive scene) the number of
// elements may be outdated and the layout triggered by this function will
// generate access non-existing items.
[self.tableView reloadData];
if (base::FeatureList::IsEnabled(kIllustratedEmptyStates)) {
UIImage* emptyImage = [UIImage imageNamed:@"reading_list_empty"];
NSString* title =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment