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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1541913002: Ensure a guest WebContent's view is removed from the InputEventRouter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix variable names. Created 5 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 956831386b133641428afd818ee075f0ba86cb72..9e26f45d048d73bb90921f295f83a0a3b8410803 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -418,6 +418,20 @@ WebContentsImpl::~WebContentsImpl() {
rwh_input_event_router_.reset();
+ // If this WebContents is a guest and goes away before its view has
+ // de-registered its surface id namespace with the outermost WebContent's
+ // input event router (IER), we will lose the ability to ever deregister it,
+ // potentially resulting in a stale pointer in the IER's owner_map_.
+ // Speculative fix for https://crbug.com/570646.
+ auto input_event_router = GetOuterWebContents()
+ ? GetOuterWebContents()->GetInputEventRouter()
+ : nullptr;
+ auto render_widget_host_view =
+ static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
+ if (input_event_router && render_widget_host_view)
+ input_event_router->RemoveSurfaceIdNamespaceOwner(
+ render_widget_host_view->GetSurfaceIdNamespace());
+
// Delete all RFH pending shutdown, which will lead the corresponding RVH to
// shutdown and be deleted as well.
frame_tree_.ForEach(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698