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

Unified Diff: chrome/browser/ui/views/browser_actions_container.cc

Issue 9535020: Fix DCHECK in BrowserActionsContainer::OnWidgetClosing (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix comments Created 8 years, 10 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 | « 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/ui/views/browser_actions_container.cc
diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc
index ef3dd6e7008693358b448560840b4d8e19296beb..b014d1f5ebd14e86aaf75f4811276d4d14dd00e5 100644
--- a/chrome/browser/ui/views/browser_actions_container.cc
+++ b/chrome/browser/ui/views/browser_actions_container.cc
@@ -813,8 +813,12 @@ void BrowserActionsContainer::InspectPopup(ExtensionAction* action) {
}
void BrowserActionsContainer::OnWidgetClosing(views::Widget* widget) {
- DCHECK_EQ(popup_->GetWidget(), widget);
- popup_->GetWidget()->RemoveObserver(this);
+ // Always remove this as an observer of a closing popup.
+ widget->RemoveObserver(this);
+ // If a new popup has been opened before this gets called, |popup_| will
sky 2012/03/02 20:53:50 Can't this go back to a DCHECK now?
stevenjb 2012/03/02 21:29:13 Since closing a window is independent from calls t
+ // point to the new popup, so just return.
+ if (!popup_ || popup_->GetWidget() != widget)
+ return;
popup_ = NULL;
// |popup_button_| is NULL if the extension has been removed.
if (popup_button_) {
@@ -834,9 +838,15 @@ void BrowserActionsContainer::MoveBrowserAction(const std::string& extension_id,
}
void BrowserActionsContainer::HidePopup() {
+ // Remove this as an observer and clear |popup_| and |popup_button_| here,
+ // since we might change them before OnWidgetClosing() gets called.
if (popup_) {
+ popup_->GetWidget()->RemoveObserver(this);
popup_->GetWidget()->Close();
- // NULL out popup_button_ in case it's being deleted.
+ popup_ = NULL;
+ }
+ if (popup_button_) {
+ popup_button_->SetButtonNotPushed();
popup_button_ = NULL;
}
}
« 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