Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: ui/views/widget/root_view.cc

Issue 169443005: Fix crash which occurs when a widget destroys itself as a result of ET_GESTURE_TAP_DOWN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/caption_buttons/frame_maximize_button_unittest.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/root_view.cc
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc
index f3ad2a08d6849b779e7bf5634218b57b6144176f..ebab579bf139481c062ecb5963362828fe32c541 100644
--- a/ui/views/widget/root_view.cc
+++ b/ui/views/widget/root_view.cc
@@ -224,7 +224,13 @@ void RootView::DispatchGestureEvent(ui::GestureEvent* event) {
(event->IsScrollGestureEvent() || event->IsFlingScrollEvent()) ?
scroll_gesture_handler_ : gesture_handler_;
ui::GestureEvent handler_event(*event, static_cast<View*>(this), handler);
- DispatchEventToTarget(handler, &handler_event);
+
+ {
+ WidgetDeletionObserver widget_deletion_observer(widget_);
+ DispatchEventToTarget(handler, &handler_event);
sadrul 2014/02/18 12:53:26 This is also an issue for other kinds of event dis
+ if (!widget_deletion_observer.IsWidgetAlive())
+ return;
+ }
if (event->type() == ui::ET_GESTURE_END &&
event->details().touch_points() <= 1) {
@@ -312,7 +318,13 @@ void RootView::DispatchGestureEvent(ui::GestureEvent* event) {
// See if this view wants to handle the Gesture.
ui::GestureEvent gesture_event(*event, static_cast<View*>(this),
gesture_handler_);
- DispatchEventToTarget(gesture_handler_, &gesture_event);
+
+ {
+ WidgetDeletionObserver widget_deletion_observer(widget_);
+ DispatchEventToTarget(gesture_handler_, &gesture_event);
+ if (!widget_deletion_observer.IsWidgetAlive())
+ return;
+ }
// The view could have removed itself from the tree when handling
// OnGestureEvent(). So handle as per OnMousePressed. NB: we
« no previous file with comments | « ash/wm/caption_buttons/frame_maximize_button_unittest.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698