Skip to content

Commit

Permalink
[Merge M58] 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.

NOTRY=true
NOPRESUBMIT=true
TBR=skuhne@chromium.org

BUG=684860
TEST=Manually, no more crashes.

Review-Url: https://codereview.chromium.org/2736993002
Cr-Commit-Position: refs/heads/master@{#455315}
(cherry picked from commit a897192)

Review-Url: https://codereview.chromium.org/2738773003
Cr-Commit-Position: refs/branch-heads/3029@{#55}
Cr-Branched-From: 939b32e-refs/heads/master@{#454471}
  • Loading branch information
khmel authored and Commit bot committed Mar 8, 2017
1 parent a5f2e63 commit eb7089a
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 eb7089a

Please sign in to comment.