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

Unified Diff: chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc

Issue 2798583002: WebUI: prevent WebContent to hold invalid pointer. (Closed)
Patch Set: Remove reference to |this| when the WebContent is no more owned. Created 3 years, 8 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: chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc
diff --git a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc
index fc5275f224f37bb50e7f8be00abf2afa5c3ac54d..b65986ea0e8048c92289bf94f923e7e02b90c685 100644
--- a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc
+++ b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc
@@ -82,6 +82,9 @@ bool ConstrainedWebDialogDelegateBase::closed_via_webui() const {
}
void ConstrainedWebDialogDelegateBase::ReleaseWebContentsOnDialogClose() {
+ // Remove reference to |this| in the WebContent since the lifetime of the
+ // WebContent may exceed the one of this object.
+ ConstrainedWebDialogUI::ClearConstrainedDelegate(web_contents_.get());
Avi (use Gerrit) 2017/04/04 14:49:46 This doesn't look right. // If called, on dialo
arthursonzogni 2017/04/04 15:17:52 I can't. [See the answer above]. Clearing the poin
Lei Zhang 2017/04/06 09:12:54 Please double check my work: Starting from PrintP
release_contents_on_close_ = true;
}

Powered by Google App Engine
This is Rietveld 408576698