Avoid touching ExtendedAuthenticatorImpl's ref count before its fully constructed
ExtendedAuthenticatorImpl is a ref counted object. Its first reference is taken by base::Bind in its constructor, and the reference is passed to GetSystemSalt to do an asynchronous task. However, if GetSystemSalt impl drops the passed callback soon, (e.g. by PostTask failure), the reference to ExtendedAuthenticatorImpl is gone and the instance is destroyed, even before the construction has completed. That is, `new ExtendedAuthenticatorImpl` might return a stale pointer on the previous code. This CL adds a static constructor to ExtendedAuthenticatorImpl, and moves the problematic part out of the constructor. Bug: 866456 Change-Id: I377acc8a753c01a79a4cf09617bfa3b0f6aa923f Reviewed-on: https://chromium-review.googlesource.com/1148164Reviewed-by:Antoine Labour <piman@chromium.org> Commit-Queue: Taiju Tsuiki <tzik@chromium.org> Cr-Commit-Position: refs/heads/master@{#577766}
Showing
Please register or sign in to comment