Commit db8dcff0 authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Commit Bot

Fix potential crash in StackedNotificationBar

Need to make sure we add it as observer
after fully initializing notification_icons_container_

Change-Id: Icd511f3dfdaac653899ddd9a09f64c62bd459ab4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023853Reviewed-by: default avatarTim Song <tengs@chromium.org>
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735669}
parent 4e7d6cc7
...@@ -243,7 +243,6 @@ StackedNotificationBar::StackedNotificationBar( ...@@ -243,7 +243,6 @@ StackedNotificationBar::StackedNotificationBar(
views::BoxLayout::CrossAxisAlignment::kStretch); views::BoxLayout::CrossAxisAlignment::kStretch);
if (features::IsUnifiedMessageCenterRefactorEnabled()) { if (features::IsUnifiedMessageCenterRefactorEnabled()) {
message_center::MessageCenter::Get()->AddObserver(this);
notification_icons_container_ = new views::View(); notification_icons_container_ = new views::View();
notification_icons_container_->SetLayoutManager( notification_icons_container_->SetLayoutManager(
std::make_unique<views::BoxLayout>( std::make_unique<views::BoxLayout>(
...@@ -251,6 +250,7 @@ StackedNotificationBar::StackedNotificationBar( ...@@ -251,6 +250,7 @@ StackedNotificationBar::StackedNotificationBar(
kStackedNotificationIconsContainerPadding, kStackedNotificationIconsContainerPadding,
kStackedNotificationBarIconSpacing)); kStackedNotificationBarIconSpacing));
AddChildView(notification_icons_container_); AddChildView(notification_icons_container_);
message_center::MessageCenter::Get()->AddObserver(this);
} }
count_label_->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor( count_label_->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor(
......
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