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

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 spelling nit 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..84dcfec58237d54eab479eecdf191b75a81f51ee 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_->GetWidget() != widget)
+ return;
popup_ = NULL;
// |popup_button_| is NULL if the extension has been removed.
if (popup_button_) {
@@ -834,8 +838,12 @@ void BrowserActionsContainer::MoveBrowserAction(const std::string& extension_id,
}
void BrowserActionsContainer::HidePopup() {
- if (popup_) {
+ if (popup_)
popup_->GetWidget()->Close();
sky 2012/03/01 21:06:01 I think we should remove the observer at line 841
stevenjb 2012/03/02 19:43:47 Agreed. Added that and set popup_ to NULL here + c
+ if (popup_button_) {
+ // Set the popup button to not pushed here, since we might change popup_
+ // before OnWidgetClosing() gets called.
+ popup_button_->SetButtonNotPushed();
// NULL out popup_button_ in case it's being deleted.
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