Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(990)

Unified Diff: chrome/browser/ui/app_list/start_page_service.cc

Issue 976553003: Fix Launcher crash in ChromeOS guest mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile warnings on Linux. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/start_page_service.cc
diff --git a/chrome/browser/ui/app_list/start_page_service.cc b/chrome/browser/ui/app_list/start_page_service.cc
index 068bdafee57d17f27955f3635b5934534854752e..9f57ccc664b754d2a0e97b869679ca18047dd274 100644
--- a/chrome/browser/ui/app_list/start_page_service.cc
+++ b/chrome/browser/ui/app_list/start_page_service.cc
@@ -86,6 +86,15 @@ class StartPageService::ProfileDestroyObserver
public:
explicit ProfileDestroyObserver(StartPageService* service)
: service_(service) {
+ if (service_->profile()->IsOffTheRecord()) {
+ // We need to be notified when the original profile gets destroyed as well
+ // as the OTR profile, because the original profile will be destroyed
+ // first, and a DCHECK at that time ensures that the OTR profile has 0
+ // hosts. See http://crbug.com/463419.
+ registrar_.Add(
+ this, chrome::NOTIFICATION_PROFILE_DESTROYED,
+ content::Source<Profile>(service_->profile()->GetOriginalProfile()));
tapted 2015/03/04 05:01:11 is that bug likely to get fixed? (could you just r
Matt Giuca 2015/03/04 06:07:05 I think it's definitely a bug either way, with one
tapted 2015/03/04 07:45:09 Acknowledged.
+ }
registrar_.Add(this,
chrome::NOTIFICATION_PROFILE_DESTROYED,
content::Source<Profile>(service_->profile()));
@@ -97,8 +106,10 @@ class StartPageService::ProfileDestroyObserver
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override {
+ Profile* source_profile = content::Source<Profile>(source).ptr();
DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
- DCHECK_EQ(service_->profile(), content::Source<Profile>(source).ptr());
+ DCHECK(source_profile == service_->profile() ||
tapted 2015/03/04 05:01:10 up to you, but you could also do DCHECK(service_-
Matt Giuca 2015/03/04 06:07:06 Done. (Yeah, that's better.) (Although I had to s
+ source_profile == service_->profile()->GetOriginalProfile());
service_->Shutdown();
tapted 2015/03/04 05:01:11 I doubt it really matters, but is it worth doing r
Matt Giuca 2015/03/04 06:07:05 Done. (Although I tested that Shutdown was idempot
}

Powered by Google App Engine
This is Rietveld 408576698