From 94274baf88646d2f3bf642fc80eb851683c5efa7 Mon Sep 17 00:00:00 2001 From: Toshinari Nakamura Date: Mon, 4 Aug 2014 17:05:48 +0900 Subject: [PATCH] fix cancelAll crash (Issue #809) https://github.com/rs/SDWebImage/issues/809 --- SDWebImage/SDWebImageManager.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SDWebImage/SDWebImageManager.m b/SDWebImage/SDWebImageManager.m index 2781ec8..e545a84 100644 --- a/SDWebImage/SDWebImageManager.m +++ b/SDWebImage/SDWebImageManager.m @@ -283,8 +283,9 @@ - (void)saveImageToCache:(UIImage *)image forURL:(NSURL *)url { - (void)cancelAll { @synchronized (self.runningOperations) { - [self.runningOperations makeObjectsPerformSelector:@selector(cancel)]; - [self.runningOperations removeAllObjects]; + NSArray *copiedOperations = [self.runningOperations copy]; + [copiedOperations makeObjectsPerformSelector:@selector(cancel)]; + [self.runningOperations removeObjectsInArray:copiedOperations]; } }