Commit a4efaac9 authored by Xiyuan Xia's avatar Xiyuan Xia Committed by Commit Bot

Clean up ref when AuthStatusConsumer goes away

ExtendedAuthenticator(Impl) could out-live AuthStatusConsumer.
Hence AuthStatusConsumer should clean up its reference in
the ExtendedAuthenticator before it is released.

Bug: 788987
Change-Id: Ie489da7b0c085cbfa7723b01692855c3457cf90a
Reviewed-on: https://chromium-review.googlesource.com/794842Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519899}
parent 6edaf9cb
...@@ -285,7 +285,10 @@ QuickUnlockPrivateGetCredentialRequirementsFunction::Run() { ...@@ -285,7 +285,10 @@ QuickUnlockPrivateGetCredentialRequirementsFunction::Run() {
QuickUnlockPrivateSetModesFunction::QuickUnlockPrivateSetModesFunction() QuickUnlockPrivateSetModesFunction::QuickUnlockPrivateSetModesFunction()
: chrome_details_(this) {} : chrome_details_(this) {}
QuickUnlockPrivateSetModesFunction::~QuickUnlockPrivateSetModesFunction() {} QuickUnlockPrivateSetModesFunction::~QuickUnlockPrivateSetModesFunction() {
if (extended_authenticator_)
extended_authenticator_->SetConsumer(nullptr);
}
void QuickUnlockPrivateSetModesFunction::SetAuthenticatorAllocatorForTesting( void QuickUnlockPrivateSetModesFunction::SetAuthenticatorAllocatorForTesting(
const QuickUnlockPrivateSetModesFunction::AuthenticatorAllocator& const QuickUnlockPrivateSetModesFunction::AuthenticatorAllocator&
...@@ -347,6 +350,7 @@ ExtensionFunction::ResponseAction QuickUnlockPrivateSetModesFunction::Run() { ...@@ -347,6 +350,7 @@ ExtensionFunction::ResponseAction QuickUnlockPrivateSetModesFunction::Run() {
// Lazily allocate the authenticator. We do this here, instead of in the ctor, // Lazily allocate the authenticator. We do this here, instead of in the ctor,
// so that tests can install a fake. // so that tests can install a fake.
DCHECK(!extended_authenticator_);
if (authenticator_allocator_.is_null()) if (authenticator_allocator_.is_null())
extended_authenticator_ = chromeos::ExtendedAuthenticator::Create(this); extended_authenticator_ = chromeos::ExtendedAuthenticator::Create(this);
else else
......
...@@ -573,8 +573,11 @@ ScreenLocker::~ScreenLocker() { ...@@ -573,8 +573,11 @@ ScreenLocker::~ScreenLocker() {
VLOG(1) << "Destroying ScreenLocker " << this; VLOG(1) << "Destroying ScreenLocker " << this;
DCHECK(base::MessageLoopForUI::IsCurrent()); DCHECK(base::MessageLoopForUI::IsCurrent());
if (authenticator_.get()) if (authenticator_)
authenticator_->SetConsumer(nullptr); authenticator_->SetConsumer(nullptr);
if (extended_authenticator_)
extended_authenticator_->SetConsumer(nullptr);
ClearErrors(); ClearErrors();
screen_locker_ = nullptr; screen_locker_ = nullptr;
......
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