Merge pull request #747 from peymano/race-condition-fix-in-uiimageview

Fix race condition in UIImageView+AFNetworking
This commit is contained in:
Mattt Thompson 2013-01-24 14:05:52 -08:00
commit 349534188a

View file

@ -120,7 +120,9 @@ static char kAFImageRequestOperationObjectKey;
self.image = responseObject; self.image = responseObject;
} }
self.af_imageRequestOperation = nil; if (self.af_imageRequestOperation == operation) {
self.af_imageRequestOperation = nil;
}
} }
[[[self class] af_sharedImageCache] cacheImage:responseObject forRequest:urlRequest]; [[[self class] af_sharedImageCache] cacheImage:responseObject forRequest:urlRequest];
@ -130,7 +132,9 @@ static char kAFImageRequestOperationObjectKey;
failure(operation.request, operation.response, error); failure(operation.request, operation.response, error);
} }
self.af_imageRequestOperation = nil; if (self.af_imageRequestOperation == operation) {
self.af_imageRequestOperation = nil;
}
} }
}]; }];