Commit 967c6b4b authored by yoshiki iguchi's avatar yoshiki iguchi Committed by Commit Bot

Prevent crash on ArcApplicationNotifierController on shutdown

The clean-up code touched a profile after the profiles were destroyed. This
patch fixes this issue.

Bug: 783538
Test: none
Change-Id: If010a424e0fbcac2188eb5546c1e4917214dcbc2
Reviewed-on: https://chromium-review.googlesource.com/765635Reviewed-by: default avatarDaichi Hirono <hirono@chromium.org>
Commit-Queue: Yoshiki Iguchi <yoshiki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515908}
parent a450ecc3
......@@ -7,7 +7,9 @@
#include <set>
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "ui/base/layout.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
......@@ -110,8 +112,14 @@ void ArcApplicationNotifierControllerChromeOS::OnIconUpdated(ArcAppIcon* icon) {
void ArcApplicationNotifierControllerChromeOS::StopObserving() {
if (!last_profile_)
return;
ArcAppListPrefs* const app_list = ArcAppListPrefs::Get(last_profile_);
app_list->RemoveObserver(this);
// This is also called from the destructor during shutdown. In that case, the
// profile manager and the profiles are already destroyed. (see Issue 783538)
if (g_browser_process->profile_manager() &&
g_browser_process->profile_manager()->IsValidProfile(last_profile_)) {
ArcAppListPrefs* const app_list = ArcAppListPrefs::Get(last_profile_);
app_list->RemoveObserver(this);
}
last_profile_ = nullptr;
}
......
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