From 4410c2c697a5a2d5e97474c5b754e267d58fc191 Mon Sep 17 00:00:00 2001 From: "skuhne@chromium.org" Date: Tue, 11 Jun 2013 04:48:52 +0000 Subject: [PATCH] Fixing notification crasher when opening of the tray menu falls together with the opeing of a message The problem was that between creating the |system_bubble_| and the finishing of the initialization, a message was trying to show. Since the system_bubble_ is at that point in time not fully initialized, the fast user clicking can cause a crash due to access to the |system_bubble_|. BUG=247416 TEST=visual Review URL: https://chromiumcodereview.appspot.com/16395004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205416 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/system/tray/system_tray.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index 16930581df14a7..677c710c38df64 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc @@ -453,7 +453,13 @@ void SystemTray::UpdateNotificationBubble() { this, notification_items_, SystemTrayBubble::BUBBLE_TYPE_NOTIFICATION); views::View* anchor; TrayBubbleView::AnchorType anchor_type; - if (system_bubble_.get() && system_bubble_->bubble_view()) { + // Tray items might want to show notifications while we are creating and + // initializing the |system_bubble_| - but it might not be fully initialized + // when coming here - this would produce a crashed like crbug.com/247416. + // As such we check the existence of the widget here. + if (system_bubble_.get() && + system_bubble_->bubble_view() && + system_bubble_->bubble_view()->GetWidget()) { anchor = system_bubble_->bubble_view(); anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; } else {