Authored by Charlie Savage

Images can be downloaded in multiple threads. Therefore the call to self.failed…

…URLs containsObject:url must be synchronized to avoid a collection mutation error.
... ... @@ -83,7 +83,13 @@
__block SDWebImageCombinedOperation *operation = SDWebImageCombinedOperation.new;
__weak SDWebImageCombinedOperation *weakOperation = operation;
if (!url || !completedBlock || (!(options & SDWebImageRetryFailed) && [self.failedURLs containsObject:url]))
BOOL isFailedUrl = NO;
@synchronized(self.failedURLs)
{
isFailedUrl = [self.failedURLs containsObject:url];
}
if (!url || !completedBlock || (!(options & SDWebImageRetryFailed) && isFailedUrl))
{
if (completedBlock) completedBlock(nil, nil, SDImageCacheTypeNone, NO);
return operation;
... ...