Merge pull request #747 from peymano/race-condition-fix-in-uiimageview
Fix race condition in UIImageView+AFNetworking
This commit is contained in:
commit
349534188a
1 changed files with 10 additions and 6 deletions
|
|
@ -120,8 +120,10 @@ static char kAFImageRequestOperationObjectKey;
|
||||||
self.image = responseObject;
|
self.image = responseObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.af_imageRequestOperation == operation) {
|
||||||
self.af_imageRequestOperation = nil;
|
self.af_imageRequestOperation = nil;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[[[self class] af_sharedImageCache] cacheImage:responseObject forRequest:urlRequest];
|
[[[self class] af_sharedImageCache] cacheImage:responseObject forRequest:urlRequest];
|
||||||
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
||||||
|
|
@ -130,8 +132,10 @@ static char kAFImageRequestOperationObjectKey;
|
||||||
failure(operation.request, operation.response, error);
|
failure(operation.request, operation.response, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.af_imageRequestOperation == operation) {
|
||||||
self.af_imageRequestOperation = nil;
|
self.af_imageRequestOperation = nil;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
self.af_imageRequestOperation = requestOperation;
|
self.af_imageRequestOperation = requestOperation;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue