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

Unified Diff: chrome/browser/extensions/theme_installed_infobar_delegate.cc

Issue 5326011: Check that TabContents is valid (not null) before removing theme change InfoBar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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: chrome/browser/extensions/theme_installed_infobar_delegate.cc
diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.cc b/chrome/browser/extensions/theme_installed_infobar_delegate.cc
index 49f690c65953dacc65a890dbac84df9081e973ce..0e374b6238c2bc39883de8834ebfc2a39fb5d15f 100644
--- a/chrome/browser/extensions/theme_installed_infobar_delegate.cc
+++ b/chrome/browser/extensions/theme_installed_infobar_delegate.cc
@@ -98,8 +98,17 @@ void ThemeInstalledInfoBarDelegate::Observe(
// If the new theme is different from what this info bar is associated
// with, close this info bar since it is no longer relevant.
const Extension* extension = Details<const Extension>(details).ptr();
- if (!extension || theme_id_ != extension->id())
- tab_contents_->RemoveInfoBar(this);
+ if (!extension || theme_id_ != extension->id()) {
+ if (tab_contents_ && !tab_contents_->is_being_destroyed()) {
+ tab_contents_->RemoveInfoBar(this);
+ // The infobar is gone so there is no reason for this delegate to keep
+ // a pointer to the tab_contents (a new delegate will be created if a new
+ // infobar is created). The delegate can not be deleted yet because
+ // it is still needed if we "undo" the theme change that triggered
Aaron Boodman 2010/12/01 01:06:06 I think it would probably be good to reference the
Tessa MacDuff 2010/12/01 19:16:37 Done.
+ // this notification.
+ tab_contents_ = NULL;
+ }
+ }
}
bool ThemeInstalledInfoBarDelegate::MatchesTheme(const Extension* theme) {
« 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