Index: chrome/browser/ui/views/panels/panel_view.cc |
diff --git a/chrome/browser/ui/views/panels/panel_view.cc b/chrome/browser/ui/views/panels/panel_view.cc |
index 017cfbebf3e37bff67a7c5ad43c77a9c61dd64b0..e49a0fb6c6cf44292b76a06eac02010a15db8e94 100644 |
--- a/chrome/browser/ui/views/panels/panel_view.cc |
+++ b/chrome/browser/ui/views/panels/panel_view.cc |
@@ -311,6 +311,8 @@ PanelView::PanelView(Panel* panel, const gfx::Rect& bounds, bool always_on_top) |
} |
PanelView::~PanelView() { |
+ if (window_) |
+ window_->RemoveObserver(this); |
} |
void PanelView::ShowPanel() { |
@@ -779,6 +781,7 @@ gfx::ImageSkia PanelView::GetWindowIcon() { |
} |
void PanelView::WindowClosing() { |
+ |
// When closing a panel via window.close, API or the close button, |
// ClosePanel() is called first, destroying the native |window_| |
// which results in this method being called. ClosePanel() sets |
@@ -948,7 +951,10 @@ bool PanelView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
} |
void PanelView::OnWidgetDestroying(views::Widget* widget) { |
- window_ = NULL; |
+ if (window_) { |
+ window_->RemoveObserver(this); |
+ window_ = NULL; |
+ } |
} |
void PanelView::OnWidgetActivationChanged(views::Widget* widget, bool active) { |