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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_service.cc

Issue 2061563002: To reproduce crashes of JSONPrefStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bug-614753-fix2
Patch Set: Test patch. Do not commit. Created 4 years, 6 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
« no previous file with comments | « chrome/browser/profiles/profile_manager_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/safe_browsing_service.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index ce6cb4def26772497f10c0638b56e37d837d451d..7a870d4fad98a5dec885860a3a0799f9b6fc75a5 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -609,8 +609,9 @@ void SafeBrowsingService::Observe(int type,
case chrome::NOTIFICATION_PROFILE_DESTROYED: {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Profile* profile = content::Source<Profile>(source).ptr();
+ PrefService* pref_service = profile->GetPrefs();
if (!profile->IsOffTheRecord())
- RemovePrefService(profile->GetPrefs());
+ RemovePrefService(pref_service);
break;
}
default:
@@ -642,12 +643,12 @@ void SafeBrowsingService::AddPrefService(PrefService* pref_service) {
}
void SafeBrowsingService::RemovePrefService(PrefService* pref_service) {
+ // If the profile fails to initialize, then |pref_service| was not added
+ // before, and therefore there is nothing to remove.
if (prefs_map_.find(pref_service) != prefs_map_.end()) {
delete prefs_map_[pref_service];
prefs_map_.erase(pref_service);
RefreshState();
- } else {
- NOTREACHED();
}
}
« no previous file with comments | « chrome/browser/profiles/profile_manager_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698