diff --git a/SDWebImage/SDWebImageManager.m b/SDWebImage/SDWebImageManager.m index 9e0adb05..a7238e83 100644 --- a/SDWebImage/SDWebImageManager.m +++ b/SDWebImage/SDWebImageManager.m @@ -30,7 +30,7 @@ static id _defaultImageLoader; @property (strong, nonatomic, readwrite, nonnull) id imageLoader; @property (strong, nonatomic, nonnull) NSMutableSet *failedURLs; @property (strong, nonatomic, nonnull) dispatch_semaphore_t failedURLsLock; // a lock to keep the access to `failedURLs` thread-safe -@property (strong, nonatomic, nonnull) NSMutableArray *runningOperations; +@property (strong, nonatomic, nonnull) NSMutableSet *runningOperations; @property (strong, nonatomic, nonnull) dispatch_semaphore_t runningOperationsLock; // a lock to keep the access to `runningOperations` thread-safe @end @@ -86,7 +86,7 @@ static id _defaultImageLoader; _imageLoader = loader; _failedURLs = [NSMutableSet new]; _failedURLsLock = dispatch_semaphore_create(1); - _runningOperations = [NSMutableArray new]; + _runningOperations = [NSMutableSet new]; _runningOperationsLock = dispatch_semaphore_create(1); } return self; @@ -165,7 +165,7 @@ static id _defaultImageLoader; - (void)cancelAll { LOCK(self.runningOperationsLock); - NSArray *copiedOperations = [self.runningOperations copy]; + NSSet *copiedOperations = [self.runningOperations copy]; UNLOCK(self.runningOperationsLock); [copiedOperations makeObjectsPerformSelector:@selector(cancel)]; // This will call `safelyRemoveOperationFromRunning:` and remove from the array }