Skip to content

Commit eb7089a

Browse files
khmelCommit bot
khmel
authored and
Commit bot
committed
[Merge M58] Fix crash whem window created before shelf creation.
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 [email protected] 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}
1 parent a5f2e63 commit eb7089a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_controller.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "chrome/browser/profiles/profile.h"
88
#include "chrome/browser/profiles/profile_manager.h"
9+
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
910
#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
1011
#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
1112
#include "components/signin/core/account_id/account_id.h"
@@ -15,7 +16,14 @@
1516

1617
MultiProfileAppWindowLauncherController::
1718
MultiProfileAppWindowLauncherController(ChromeLauncherController* owner)
18-
: ExtensionAppWindowLauncherController(owner) {}
19+
: ExtensionAppWindowLauncherController(owner) {
20+
// We might have already active windows.
21+
extensions::AppWindowRegistry* registry =
22+
extensions::AppWindowRegistry::Get(owner->profile());
23+
app_window_list_.insert(app_window_list_.end(),
24+
registry->app_windows().begin(),
25+
registry->app_windows().end());
26+
}
1927

2028
MultiProfileAppWindowLauncherController::
2129
~MultiProfileAppWindowLauncherController() {
@@ -61,6 +69,7 @@ void MultiProfileAppWindowLauncherController::AdditionalUserAddedToSession(
6169
// Each users AppWindowRegistry needs to be observed.
6270
extensions::AppWindowRegistry* registry =
6371
extensions::AppWindowRegistry::Get(profile);
72+
DCHECK(registry->app_windows().empty());
6473
multi_user_registry_.push_back(registry);
6574
registry->AddObserver(this);
6675
}

0 commit comments

Comments
 (0)