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

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

Issue 996103009: Fix for a crasher in the browser seen while dispatching mouse enter or mouse exit messages via the … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 5 years, 9 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 | « no previous file | ui/views/widget/root_view_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 6e45f3566e465e11e7c426ff4ec06ba5a926c60b..ee11f6f258590c9fe4e0742e7a156dcc41a66364 100644
--- a/ui/views/widget/root_view.cc
+++ b/ui/views/widget/root_view.cc
@@ -493,8 +493,13 @@ void RootView::OnMouseMoved(const ui::MouseEvent& event) {
DispatchEvent(mouse_move_handler_, &exit);
if (dispatch_details.dispatcher_destroyed)
return;
- NotifyEnterExitOfDescendant(event, ui::ET_MOUSE_EXITED,
- mouse_move_handler_, v);
+ // The mouse_move_handler_ could have been destroyed in the context of
+ // the mouse exit event.
+ if (!dispatch_details.target_destroyed) {
+ CHECK(mouse_move_handler_);
+ NotifyEnterExitOfDescendant(event, ui::ET_MOUSE_EXITED,
+ mouse_move_handler_, v);
+ }
}
View* old_handler = mouse_move_handler_;
mouse_move_handler_ = v;
@@ -507,8 +512,13 @@ void RootView::OnMouseMoved(const ui::MouseEvent& event) {
DispatchEvent(mouse_move_handler_, &entered);
if (dispatch_details.dispatcher_destroyed)
return;
- NotifyEnterExitOfDescendant(event, ui::ET_MOUSE_ENTERED,
- mouse_move_handler_, old_handler);
+ // The mouse_move_handler_ could have been destroyed in the context of
+ // the mouse exit event.
+ if (!dispatch_details.target_destroyed) {
+ CHECK(mouse_move_handler_);
+ NotifyEnterExitOfDescendant(event, ui::ET_MOUSE_ENTERED,
+ mouse_move_handler_, old_handler);
+ }
}
}
ui::MouseEvent moved_event(event, static_cast<View*>(this),
@@ -525,8 +535,13 @@ void RootView::OnMouseMoved(const ui::MouseEvent& event) {
DispatchEvent(mouse_move_handler_, &exited);
if (dispatch_details.dispatcher_destroyed)
return;
- NotifyEnterExitOfDescendant(event, ui::ET_MOUSE_EXITED,
- mouse_move_handler_, v);
+ // The mouse_move_handler_ could have been destroyed in the context of the
+ // mouse exit event.
+ if (!dispatch_details.target_destroyed) {
+ CHECK(mouse_move_handler_);
+ NotifyEnterExitOfDescendant(event, ui::ET_MOUSE_EXITED,
+ mouse_move_handler_, v);
+ }
// On Aura the non-client area extends slightly outside the root view for
// some windows. Let the non-client cursor handling code set the cursor
// as we do above.
@@ -543,8 +558,13 @@ void RootView::OnMouseExited(const ui::MouseEvent& event) {
DispatchEvent(mouse_move_handler_, &exited);
if (dispatch_details.dispatcher_destroyed)
return;
- NotifyEnterExitOfDescendant(event, ui::ET_MOUSE_EXITED,
- mouse_move_handler_, NULL);
+ // The mouse_move_handler_ could have been destroyed in the context of the
+ // mouse exit event.
+ if (!dispatch_details.target_destroyed) {
+ CHECK(mouse_move_handler_);
+ NotifyEnterExitOfDescendant(event, ui::ET_MOUSE_EXITED,
+ mouse_move_handler_, NULL);
+ }
mouse_move_handler_ = NULL;
}
}
« no previous file with comments | « no previous file | ui/views/widget/root_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698