Images can be downloaded in multiple threads. Therefore the call to self.failedURLs containsObject:url must be synchronized to avoid a collection mutation error.
This commit is contained in:
parent
990df9f828
commit
0426f07355
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue