From 2f892f968fe03e82f468adf9df20fd6b06254aea Mon Sep 17 00:00:00 2001 From: Bogdan Poplauschi Date: Tue, 8 Aug 2017 13:19:20 +0300 Subject: [PATCH] Attempt to fix #1883 by using a weakSelf reference to remove from callbackBlocks (on the barrierQueue) --- SDWebImage/SDWebImageDownloaderOperation.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageDownloaderOperation.m b/SDWebImage/SDWebImageDownloaderOperation.m index b8c78ba4..f9c825a5 100644 --- a/SDWebImage/SDWebImageDownloaderOperation.m +++ b/SDWebImage/SDWebImageDownloaderOperation.m @@ -223,8 +223,9 @@ typedef NSMutableDictionary SDCallbacksDictionary; } - (void)reset { + __weak typeof(self) weakSelf = self; dispatch_barrier_async(self.barrierQueue, ^{ - [self.callbackBlocks removeAllObjects]; + [weakSelf.callbackBlocks removeAllObjects]; }); self.dataTask = nil; self.imageData = nil;