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

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

Issue 2112923002: Fix crash when destroying a RenderWidgetHost that holds the pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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 2978fb9e1c1e386f7eec5be92e6fee02b2192435..aebfc621b04a5717759089417a4d33e4f38161fa 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1683,8 +1683,7 @@ void WebContentsImpl::RenderWidgetDeleted(
view_->RestoreFocus();
}
- if (mouse_lock_widget_ == render_widget_host)
- mouse_lock_widget_ = nullptr;
+ DCHECK(mouse_lock_widget_ != render_widget_host);
Charlie Reis 2016/07/06 17:41:47 DCHECKs aren't compiled into release builds, so th
lfg 2016/07/07 20:17:35 Let's change it to a CHECK then, so we can force a
Charlie Reis 2016/07/07 21:47:12 Acknowledged.
}
void WebContentsImpl::RenderWidgetGotFocus(
@@ -1905,6 +1904,11 @@ void WebContentsImpl::LostMouseLock(RenderWidgetHostImpl* render_widget_host) {
delegate_->LostMouseLock();
}
+bool WebContentsImpl::HasMouseLock(RenderWidgetHostImpl* render_widget_host) {
+ return mouse_lock_widget_ == render_widget_host &&
+ GetTopLevelRenderWidgetHostView()->IsMouseLocked();
Charlie Reis 2016/07/06 17:41:47 This is confusing to me at first glance. Why is i
lfg 2016/07/07 20:17:35 There's two parts to this. First the mouse_lock_wi
Charlie Reis 2016/07/07 21:47:12 Acknowledged.
+}
+
void WebContentsImpl::ForwardCompositorProto(
RenderWidgetHostImpl* render_widget_host,
const std::vector<uint8_t>& proto) {
@@ -2962,8 +2966,11 @@ bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) {
if (GetBrowserPluginGuest())
return GetBrowserPluginGuest()->LockMouse(allowed);
- if (mouse_lock_widget_)
- return mouse_lock_widget_->GotResponseToLockMouseRequest(allowed);
+ if (mouse_lock_widget_ &&
+ mouse_lock_widget_->GotResponseToLockMouseRequest(allowed))
+ return true;
+
+ mouse_lock_widget_ = nullptr;
return false;
}

Powered by Google App Engine
This is Rietveld 408576698