Commit f1228c44 authored by Tommy Li's avatar Tommy Li Committed by Commit Bot

[omnibox] Fix OmniboxPopupContentsView crash observing stale widgets

We were making too strong of assumptions about widget vs. view
lifetimes, leading to crashes.

This CL loosens those assumptions (correctly) since we only have a weak
pointer to the widget.

Bug: 1108762
Change-Id: I5eddfe7f5e9dc4e4f51c3caf35056fc2dc388989
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2316445
Auto-Submit: Tommy Li <tommycli@chromium.org>
Commit-Queue: manuk hovanesian <manukh@chromium.org>
Reviewed-by: default avatarmanuk hovanesian <manukh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791401}
parent 6413b5a4
...@@ -474,8 +474,11 @@ void OmniboxPopupContentsView::FireAXEventsForNewActiveDescendant( ...@@ -474,8 +474,11 @@ void OmniboxPopupContentsView::FireAXEventsForNewActiveDescendant(
void OmniboxPopupContentsView::OnWidgetBoundsChanged( void OmniboxPopupContentsView::OnWidgetBoundsChanged(
views::Widget* widget, views::Widget* widget,
const gfx::Rect& new_bounds) { const gfx::Rect& new_bounds) {
DCHECK_EQ(popup_.get(), widget); // Because we don't directly control the lifetime of the widget, gracefully
DCHECK(popup_); // handle "stale" notifications by ignoring them. https://crbug.com/1108762
if (!popup_ || popup_.get() != widget)
return;
// This is called on rotation or device scale change. We have to re-align to // This is called on rotation or device scale change. We have to re-align to
// the new location bar location. // the new location bar location.
......
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