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

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: Remove observer in BrowserActionsContainer::HidePopup() 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..61db7a25605880da6913a7d9c04507c8280e229a 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
+ // 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,
msw 2012/03/02 20:39:35 nit: add vertical bars around identifiers in comme
stevenjb 2012/03/02 20:44:18 Done.
+ // since we might change popup_ 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