Commit 9dbbf211 authored by alemate's avatar alemate Committed by Commit bot

Fix crash on ChromeOS: ActiveUserChanged might happen before profile is created.

BUG=407375
TEST=manual

Review URL: https://codereview.chromium.org/527353002

Cr-Commit-Position: refs/heads/master@{#292966}
parent a076bf3d
......@@ -645,6 +645,12 @@ void UserSessionManager::OnProfileCreated(const UserContext& user_context,
void UserSessionManager::InitProfilePreferences(
Profile* profile,
const UserContext& user_context) {
user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile);
if (user->is_active()) {
input_method::InputMethodManager* manager =
input_method::InputMethodManager::Get();
manager->SetState(GetDefaultIMEState(profile));
}
if (user_manager::UserManager::Get()->IsCurrentUserNew()) {
SetFirstLoginPrefs(profile,
user_context.GetPublicSessionLocale(),
......@@ -987,6 +993,11 @@ void UserSessionManager::NotifyPendingUserSessionsRestoreFinished() {
void UserSessionManager::ActiveUserChanged(
const user_manager::User* active_user) {
Profile* profile = ProfileHelper::Get()->GetProfileByUser(active_user);
// If profile has not yet been initialized, delay initialization of IME.
if (!profile)
return;
input_method::InputMethodManager* manager =
input_method::InputMethodManager::Get();
manager->SetState(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment