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

Unified Diff: chrome/browser/profiles/profile_manager.cc

Issue 137323005: Fixing endless loop when getting the active profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 6 years, 11 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/chromeos/login/user.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 711740c2d4c745eedcbaff599a5fdc223413460d..825c068183fa09515e7259b5d80718ce5ab7ad35 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -304,12 +304,16 @@ Profile* ProfileManager::GetActiveUserProfile() {
return profile_manager->GetActiveUserOrOffTheRecordProfileFromPath(
profile_manager->user_data_dir());
chromeos::UserManager* manager = chromeos::UserManager::Get();
- // Note: The user manager will take care of guest profiles.
- return manager->GetProfileByUser(manager->GetActiveUser());
-#else
+ const chromeos::User* user = manager->GetActiveUser();
+ // To avoid an endless loop (crbug.com/334098) we have to additionally check
+ // if the profile of the user was already created. If the profile was not yet
+ // created we load the profile using the profile directly.
+ // TODO: This should be cleaned up with the new profile manager.
+ if (user && user->is_profile_created())
+ return manager->GetProfileByUser(user);
+#endif
return profile_manager->GetActiveUserOrOffTheRecordProfileFromPath(
profile_manager->user_data_dir());
-#endif
}
Profile* ProfileManager::GetProfile(const base::FilePath& profile_dir) {
« no previous file with comments | « chrome/browser/chromeos/login/user.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698