Commit 4009dbbb authored by Ryan Hansberry's avatar Ryan Hansberry Committed by Commit Bot

Verify ProximityAuthProfilePrefManager local state before persisting to it.

The local_state_ pointer was initializing to garbage memory when Chrome was run
in debug mode, causing a check if local_state_ == nullptr to incorrectly return false.
leading to a crash. This issue was preventing developers from running Chrome in debug
mode if Smart Lock is enabled.

Bug: 881958
Change-Id: Ia796eefe244ca17a1905e489aeee9a310828802c
Reviewed-on: https://chromium-review.googlesource.com/1218442Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Ryan Hansberry <hansberry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590379}
parent e1e2334a
......@@ -195,7 +195,7 @@ void ProximityAuthProfilePrefManager::OnFeatureStatesChanged(
}
feature_state_ = it->second;
if (local_state_)
if (local_state_ && account_id_.is_valid())
SyncPrefsToLocalState();
}
......
......@@ -79,20 +79,20 @@ class ProximityAuthProfilePrefManager
// Contains perferences that outlive the lifetime of this object and across
// process restarts. Not owned and must outlive this instance.
PrefService* pref_service_;
PrefService* pref_service_ = nullptr;
// Listens to pref changes so they can be synced to the local state.
PrefChangeRegistrar registrar_;
// The local state to which to sync the profile prefs.
PrefService* local_state_;
PrefService* local_state_ = nullptr;
// The account id of the current profile.
AccountId account_id_;
// Used to determine the FeatureState of Smart Lock. See |feature_state_|.
chromeos::multidevice_setup::MultiDeviceSetupClient*
multidevice_setup_client_;
multidevice_setup_client_ = nullptr;
// Caches feature state of Smart Lock. Populated by using
// |multidevice_setup_client_|.
......
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