Commit f12e6a4a authored by sadrul@chromium.org's avatar sadrul@chromium.org

ash: Do not add the tray bubble twice in the message-loop's observer list.

This fixes a crash when the bubble tries to add itself as an observer again when
it is being displayed.

BUG=125778
TEST=click on the status tray, no crash.

Review URL: https://chromiumcodereview.appspot.com/10260034

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134748 0039d316-1c4b-4281-b951-d872f2087c98
parent 7907df5e
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment