Commit e557b084 authored by W. James MacLean's avatar W. James MacLean Committed by Commit Bot

Confirm last_mouse_move_target_ still valid before context menu.

Since the context menu can be dispatched an arbitrary time after
the mouse event that sets last_mouse_move_target_, we should verify
the pointer is still valid by making sure it's still in the owner's
map.

Bug: 856976
Change-Id: I928935b74d6fa99ba7769fa170a9c817f98d5a46
Reviewed-on: https://chromium-review.googlesource.com/1116862Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: James MacLean <wjmaclean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570749}
parent ceae2654
...@@ -1543,7 +1543,11 @@ void RenderWidgetHostInputEventRouter::SetCursor(const WebCursor& cursor) { ...@@ -1543,7 +1543,11 @@ void RenderWidgetHostInputEventRouter::SetCursor(const WebCursor& cursor) {
void RenderWidgetHostInputEventRouter::ShowContextMenuAtPoint( void RenderWidgetHostInputEventRouter::ShowContextMenuAtPoint(
const gfx::Point& point, const gfx::Point& point,
const ui::MenuSourceType source_type) { const ui::MenuSourceType source_type) {
DCHECK(last_mouse_move_target_); // It's possible that since |last_mouse_move_target_| was set by the
// outbound mouse event that the view may have gone away. Before dispatching
// the context menu, confirm the view is still available.
if (!IsViewInMap(last_mouse_move_target_))
return;
auto* rwhi = static_cast<RenderWidgetHostImpl*>( auto* rwhi = static_cast<RenderWidgetHostImpl*>(
last_mouse_move_target_->GetRenderWidgetHost()); last_mouse_move_target_->GetRenderWidgetHost());
......
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