Skip to content

Commit 25b4c17

Browse files
committed
progress reports on main thread
1 parent df751e7 commit 25b4c17

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

SDWebImage/SDWebImageDownloader.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ - (void)setOperationClass:(Class)operationClass {
142142
callbacksForURL = [sself.URLCallbacks[url] copy];
143143
});
144144
for (NSDictionary *callbacks in callbacksForURL) {
145-
SDWebImageDownloaderProgressBlock callback = callbacks[kProgressCallbackKey];
146-
if (callback) callback(receivedSize, expectedSize);
145+
dispatch_async(dispatch_get_main_queue(), ^{
146+
SDWebImageDownloaderProgressBlock callback = callbacks[kProgressCallbackKey];
147+
if (callback) callback(receivedSize, expectedSize);
148+
});
147149
}
148150
}
149151
completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {

0 commit comments

Comments
 (0)