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

Unified Diff: chrome/browser/ui/website_settings/website_settings.cc

Issue 2365553002: Fix a use-after-free in WebsiteSettings::OnUIClosing. (Closed)
Patch Set: Created 4 years, 3 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 | « chrome/browser/ui/website_settings/website_settings.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/website_settings/website_settings.cc
diff --git a/chrome/browser/ui/website_settings/website_settings.cc b/chrome/browser/ui/website_settings/website_settings.cc
index 635d7d2b8943dc5c4cba9ff2c55d6b980c28a694..e1d0f98b7ebf082ef7a7ec32d52f92d801130f54 100644
--- a/chrome/browser/ui/website_settings/website_settings.cc
+++ b/chrome/browser/ui/website_settings/website_settings.cc
@@ -253,10 +253,8 @@ WebsiteSettings::WebsiteSettings(
const SecurityStateModel::SecurityInfo& security_info)
: TabSpecificContentSettings::SiteDataObserver(
tab_specific_content_settings),
+ content::WebContentsObserver(web_contents),
ui_(ui),
-#if !defined(OS_ANDROID)
- web_contents_(web_contents),
-#endif
show_info_bar_(false),
site_url_(url),
site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN),
@@ -368,9 +366,9 @@ void WebsiteSettings::OnUIClosing() {
#if defined(OS_ANDROID)
NOTREACHED();
#else
- if (show_info_bar_ && web_contents_) {
+ if (show_info_bar_ && web_contents() && !web_contents()->IsBeingDestroyed()) {
InfoBarService* infobar_service =
- InfoBarService::FromWebContents(web_contents_);
+ InfoBarService::FromWebContents(web_contents());
if (infobar_service)
WebsiteSettingsInfoBarDelegate::Create(infobar_service);
}
« no previous file with comments | « chrome/browser/ui/website_settings/website_settings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698