• Martin Kreichgauer's avatar
    fido: fix lifetime issue with MaybeAddPlatformAuthenticatorCallback · 7cbada43
    Martin Kreichgauer authored
    Currently, |AuthenticatorImpl| is binding
    |CreatePlatformAuthenticatorIfAvailable| with |base::Unretained| for the
    |MaybeAddPlatformAuthenticatorCallback| argument to the
    |FidoRequestHandlerBase| ctor. The callback was originally invoked
    synchronously from the ctor, but then recently changed to async
    invocation to account for observer registration (crrev.com/c/1175418).
    
    This is a potential callback lifetime issue because the
    AuthenticatorImpl and its request handler can now theoretically get
    destroyed before the callback gets invoked.
    
    To work around this issue, replace the callback with a method on the
    request handler invoked by the AuthenticatorImpl.
    
    Bug: 875338
    Change-Id: I089f0783a46791ae8d9d6bac5f0e663e52075b86
    Reviewed-on: https://chromium-review.googlesource.com/1179081
    Commit-Queue: Martin Kreichgauer <martinkr@google.com>
    Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
    Reviewed-by: default avatarJun Choi <hongjunchoi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#584288}
    7cbada43
fido_request_handler_base.h 6.77 KB