Cancel shelf context menu when ShelfItemDelegate is replaced.
ShelfContextMenuModel holds a raw pointer to ShelfItemDelegate. If a delegate is deleted while a menu is being shown, selecting a menu item will cause use-after-free. A delegate might be deleted from 3 places: - when a shelf item is removed (this is already handled correctly) - when ShelfModel is destroyed on shutdown (does not seem to cause problems) - when a delegate is replaced on an existing shelf item (handled in this CL). Bug: 937507 Test: ShelfViewTest.ReplacingDelegateCancelsContextMenu Change-Id: Iac551bbab7b97a863941c89ea5a056ddf330a910 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1585016 Commit-Queue: Vladislav Kaznacheev <kaznacheev@chromium.org> Auto-Submit: Vladislav Kaznacheev <kaznacheev@chromium.org> Reviewed-by:Michael Wasserman <msw@chromium.org> Reviewed-by:
Yury Khmel <khmel@chromium.org> Cr-Commit-Position: refs/heads/master@{#654544}
Showing
Please register or sign in to comment