Commit ea17936a authored by Weidong Guo's avatar Weidong Guo Committed by Commit Bot

Speculative fix for crash in paged view structure

The crash may occur when dragging an item for reparant in root level
while we need to add a page break item between two items in root level.
The two items happened to have the same position which triggers a
position fix causing a LoadFromMetadata() call during SaveToMetadata().

Changes:
Remove observer when add page break item.

Bug: 900427
Change-Id: Ie416eeb81de47cd531a6c25a16761ce1d141847f
Reviewed-on: https://chromium-review.googlesource.com/c/1313054Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604970}
parent f481306a
......@@ -94,9 +94,14 @@ void PagedViewStructure::SaveToMetadata() {
if (item_index < item_list->item_count() &&
!item_list->item_at(item_index)->is_page_break()) {
// Remove AppListItemListObserver temporarily to avoid |pages_| being
// reloaded.
item_list->RemoveObserver(apps_grid_view_);
// There's no "page break" item at the end of current page, so add one to
// push overflowing items to next page.
model->AddPageBreakItemAfter(item_list->item_at(item_index - 1));
item_list->AddObserver(apps_grid_view_);
}
}
......
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