Index: ash/system/tray/system_tray.cc |
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc |
index 4555bcb19eb81b8a7cfa17424c4ba7206b3c4a0f..5db8c25352ac398cae3e1a1356bcedc190a2776b 100644 |
--- a/ash/system/tray/system_tray.cc |
+++ b/ash/system/tray/system_tray.cc |
@@ -475,11 +475,13 @@ SystemTrayBubble::SystemTrayBubble( |
items_(items), |
detailed_(detailed), |
autoclose_delay_(0) { |
- MessageLoopForUI::current()->AddObserver(this); |
} |
SystemTrayBubble::~SystemTrayBubble() { |
+ // The bubble may be closing without having been hidden first. So it may still |
+ // be in the message-loop's observer list. |
MessageLoopForUI::current()->RemoveObserver(this); |
+ |
DestroyItemViews(); |
// Reset the host pointer in bubble_view_ in case its destruction is deferred. |
if (bubble_view_) |
@@ -510,7 +512,6 @@ void SystemTrayBubble::InitView(views::View* anchor, |
DCHECK(bubble_widget_ == NULL); |
bubble_widget_ = views::BubbleDelegateView::CreateBubble(bubble_view_); |
- |
// Must occur after call to CreateBubble() |
bubble_view_->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
bubble_widget_->non_client_view()->frame_view()->set_background(NULL); |