Skip to content

Commit

Permalink
Fix crash on ChromeOS: ActiveUserChanged might happen before profile …
Browse files Browse the repository at this point in the history
…is created.

BUG=407375
TEST=manual

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

Cr-Commit-Position: refs/heads/master@{#292966}
  • Loading branch information
alemate authored and Commit bot committed Sep 2, 2014
1 parent a076bf3 commit 9dbbf21
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions chrome/browser/chromeos/login/session/user_session_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 9dbbf21

Please sign in to comment.