Skip to content

Commit 9cc8269

Browse files
author
Olivier Poitrey
committed
Merge pull request SDWebImage#1049 from hoppenichu/fix_donwloader_2
Make sure callbacksForURL won't be modified
2 parents 17c3cf3 + 62e2320 commit 9cc8269

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

SDWebImage/SDWebImageDownloader.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ - (void)setOperationClass:(Class)operationClass {
138138
if (!sself) return;
139139
__block NSArray *callbacksForURL;
140140
dispatch_sync(sself.barrierQueue, ^{
141-
callbacksForURL = sself.URLCallbacks[url];
141+
callbacksForURL = [sself.URLCallbacks[url] copy];
142142
});
143143
for (NSDictionary *callbacks in callbacksForURL) {
144144
SDWebImageDownloaderProgressBlock callback = callbacks[kProgressCallbackKey];
@@ -150,7 +150,7 @@ - (void)setOperationClass:(Class)operationClass {
150150
if (!sself) return;
151151
__block NSArray *callbacksForURL;
152152
dispatch_barrier_sync(sself.barrierQueue, ^{
153-
callbacksForURL = sself.URLCallbacks[url];
153+
callbacksForURL = [sself.URLCallbacks[url] copy];
154154
if (finished) {
155155
[sself.URLCallbacks removeObjectForKey:url];
156156
}

0 commit comments

Comments
 (0)