Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Fix WeakPtrFactory member in SSOAccessTokenFetcher
Browse files Browse the repository at this point in the history
This forces WeakPtrs to be invalidated before other members' destructors run.
See the bug or the documentation of WeakPtrFactory for more information. I'm
in the process of trying to turn on a clang check for this (see the bug).

BUG=303818
[email protected]

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

Cr-Commit-Position: refs/heads/master@{#311408}
  • Loading branch information
davemichael authored and Commit bot committed Jan 14, 2015
1 parent 6e408ee commit 19e69d4
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ void OnAccessTokenResponse(NSString* token,
NSError* error);

private:
base::WeakPtrFactory<SSOAccessTokenFetcher> weak_factory_;
ios::ProfileOAuth2TokenServiceIOSProvider* provider_; // weak
std::string account_id_;
bool request_was_cancelled_;
base::WeakPtrFactory<SSOAccessTokenFetcher> weak_factory_;

DISALLOW_COPY_AND_ASSIGN(SSOAccessTokenFetcher);
};
Expand All @@ -88,10 +88,10 @@ void OnAccessTokenResponse(NSString* token,
ios::ProfileOAuth2TokenServiceIOSProvider* provider,
const std::string account_id)
: OAuth2AccessTokenFetcher(consumer),
weak_factory_(this),
provider_(provider),
account_id_(account_id),
request_was_cancelled_(false) {
request_was_cancelled_(false),
weak_factory_(this) {
DCHECK(provider_);
}

Expand Down

0 comments on commit 19e69d4

Please sign in to comment.