Chromium Code Reviews| 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 |