Skip to content

Commit

Permalink
Fix crash whem window created before shelf creation.
Browse files Browse the repository at this point in the history
This fix crash due race condition in multi-profile mode in case some
window is created before shelf initialized. Easiest way to repo is
on fresh machine first sign-in to public account, sign-out, sign-in
to corp Google account. ARC++ OptIn window should pop-up on start.

BUG=684860
TEST=Manually, no more crashes.

Review-Url: https://codereview.chromium.org/2736993002
Cr-Commit-Position: refs/heads/master@{#455315}
  • Loading branch information
khmel authored and Commit bot committed Mar 8, 2017
1 parent 5403a87 commit a897192
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
#include "components/signin/core/account_id/account_id.h"
Expand All @@ -15,7 +16,14 @@

MultiProfileAppWindowLauncherController::
MultiProfileAppWindowLauncherController(ChromeLauncherController* owner)
: ExtensionAppWindowLauncherController(owner) {}
: ExtensionAppWindowLauncherController(owner) {
// We might have already active windows.
extensions::AppWindowRegistry* registry =
extensions::AppWindowRegistry::Get(owner->profile());
app_window_list_.insert(app_window_list_.end(),
registry->app_windows().begin(),
registry->app_windows().end());
}

MultiProfileAppWindowLauncherController::
~MultiProfileAppWindowLauncherController() {
Expand Down Expand Up @@ -61,6 +69,7 @@ void MultiProfileAppWindowLauncherController::AdditionalUserAddedToSession(
// Each users AppWindowRegistry needs to be observed.
extensions::AppWindowRegistry* registry =
extensions::AppWindowRegistry::Get(profile);
DCHECK(registry->app_windows().empty());
multi_user_registry_.push_back(registry);
registry->AddObserver(this);
}
Expand Down

0 comments on commit a897192

Please sign in to comment.