Commit a3bc17ec authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Chromium LUCI CQ

Fix crash during shutdown

This CL adds protection to ensure a notification can not be
added after ash has been destroyed

Bug: 1164631
Change-Id: I497a142b1f05990a855ce837408adf3660247e19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2639161Reviewed-by: default avatarJustin DeWitt <dewittj@chromium.org>
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845331}
parent 50aeacaf
...@@ -136,7 +136,13 @@ void ChromeAshMessageCenterClient::Display( ...@@ -136,7 +136,13 @@ void ChromeAshMessageCenterClient::Display(
base::WrapRefCounted( base::WrapRefCounted(
new ForwardingNotificationDelegate(notification.id(), delegate_)), new ForwardingNotificationDelegate(notification.id(), delegate_)),
notification); notification);
MessageCenter::Get()->AddNotification(std::move(message_center_notification));
// During shutdown, Ash is destroyed before |this|, taking the MessageCenter
// with it.
if (MessageCenter::Get()) {
MessageCenter::Get()->AddNotification(
std::move(message_center_notification));
}
} }
void ChromeAshMessageCenterClient::Close(Profile* profile, void ChromeAshMessageCenterClient::Close(Profile* profile,
......
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