Skip to content

Commit a45c722

Browse files
committed
Merge pull request SDWebImage#1218 from mythodeia/master
progress callbacks now report on main thread
2 parents be560a4 + 25b4c17 commit a45c722

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)