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

Unified Diff: chrome/browser/ui/cocoa/profile_menu_controller.mm

Issue 11661017: [Mac] Fix profile getting re-created / IO allowed dcheck with profile menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: [Mac] Fix profile getting re-created / IO allowed dcheck with profile menu. Created 8 years 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 | « no previous file | chrome/browser/ui/cocoa/profile_menu_controller_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/profile_menu_controller.mm
===================================================================
--- chrome/browser/ui/cocoa/profile_menu_controller.mm (revision 174685)
+++ chrome/browser/ui/cocoa/profile_menu_controller.mm (working copy)
@@ -175,6 +175,19 @@
// Tell the model that the browser has changed.
model_->set_browser(browser);
+ // If |browser| is NULL, it may be because the current profile was deleted
+ // and there are no other loaded profiles. In this case, calling
+ // |model_->GetActiveProfileIndex()| may result in a profile being loaded,
+ // which is inappropriate to do on the UI thread.
+ //
+ // An early return provides the desired behavior:
+ // a) If the profile was deleted, the menu would have been rebuilt and no
+ // profile will have a check mark.
+ // b) If the profile was not deleted, but there is no active browser, then
+ // the previous profile will remain checked.
+ if (!browser)
+ return;
+
size_t active_profile_index = model_->GetActiveProfileIndex();
// Update the state for the menu items.
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/profile_menu_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698