| Index: google_apis/gaia/fake_oauth2_token_service.cc
|
| diff --git a/google_apis/gaia/fake_oauth2_token_service.cc b/google_apis/gaia/fake_oauth2_token_service.cc
|
| index 44722dd2dd3618ec9c22f3422c3d6abe01ef31cd..bd53cddad6eb9a4c26828bfc201c76aab4bd5c34 100644
|
| --- a/google_apis/gaia/fake_oauth2_token_service.cc
|
| +++ b/google_apis/gaia/fake_oauth2_token_service.cc
|
| @@ -66,10 +66,11 @@ void FakeOAuth2TokenService::IssueAllTokensForAccount(
|
| const std::string& account_id,
|
| const std::string& access_token,
|
| const base::Time& expiration) {
|
| -
|
| // Walk the requests and notify the callbacks.
|
| - for (std::vector<PendingRequest>::iterator it = pending_requests_.begin();
|
| - it != pending_requests_.end(); ++it) {
|
| + std::vector<PendingRequest> pending_requests_copy = pending_requests_;
|
| + for (std::vector<PendingRequest>::iterator it = pending_requests_copy.begin();
|
| + it != pending_requests_copy.end();
|
| + ++it) {
|
| if (it->request && (account_id == it->account_id)) {
|
| it->request->InformConsumer(
|
| GoogleServiceAuthError::AuthErrorNone(), access_token, expiration);
|
| @@ -81,8 +82,11 @@ void FakeOAuth2TokenService::IssueErrorForAllPendingRequestsForAccount(
|
| const std::string& account_id,
|
| const GoogleServiceAuthError& auth_error) {
|
| // Walk the requests and notify the callbacks.
|
| - for (std::vector<PendingRequest>::iterator it = pending_requests_.begin();
|
| - it != pending_requests_.end();
|
| + // Using a copy to make sure retyring a request does not cause a stack when
|
| + // incrementing the iterator.
|
| + std::vector<PendingRequest> pending_requests_copy = pending_requests_;
|
| + for (std::vector<PendingRequest>::iterator it = pending_requests_copy.begin();
|
| + it != pending_requests_copy.end();
|
| ++it) {
|
| if (it->request && (account_id == it->account_id)) {
|
| it->request->InformConsumer(auth_error, std::string(), base::Time());
|
|
|