Index: chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc |
diff --git a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc |
index c69b5ded277b53494ba18b852e23002b5adf1689..b8336e0ccabf3d4553ea9f2608cf9b503c234f80 100644 |
--- a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc |
+++ b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc |
@@ -33,6 +33,8 @@ ExtensionInfoBarGtk::ExtensionInfoBarGtk(InfoBarService* owner, |
delegate_(delegate), |
view_(NULL), |
ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
+ delegate->set_observer(this); |
+ |
// Always render the close button as if we were doing chrome style widget |
// rendering. For extension infobars, we force chrome style rendering because |
// extension authors are going to expect to match the declared gradient in |
@@ -46,7 +48,10 @@ ExtensionInfoBarGtk::ExtensionInfoBarGtk(InfoBarService* owner, |
BuildWidgets(); |
} |
-ExtensionInfoBarGtk::~ExtensionInfoBarGtk() {} |
+ExtensionInfoBarGtk::~ExtensionInfoBarGtk() { |
+ if (delegate_) |
+ delegate_->set_observer(NULL); |
+} |
void ExtensionInfoBarGtk::PlatformSpecificHide(bool animate) { |
// This view is not owned by us; we can't unparent it because we aren't the |
@@ -148,6 +153,10 @@ void ExtensionInfoBarGtk::StoppedShowing() { |
gtk_chrome_button_unset_paint_state(GTK_CHROME_BUTTON(button_)); |
} |
+void ExtensionInfoBarGtk::OnDelegateDeleted() { |
+ delegate_ = NULL; |
+} |
+ |
Browser* ExtensionInfoBarGtk::GetBrowser() { |
// Get the Browser object this infobar is attached to. |
GtkWindow* parent = platform_util::GetTopLevel(icon_); |