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. |