Performing cache callbacks from the ioQueue asynchronously.
- more appropriate than dispatch_main_sync_safe, since we’ll always be on the ioQueue when calling - prevents deadlock situation described in #625
Showing
1 changed file
with
3 additions
and
3 deletions
@@ -296,7 +296,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { | @@ -296,7 +296,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { | ||
296 | [self.memCache setObject:diskImage forKey:key cost:cost]; | 296 | [self.memCache setObject:diskImage forKey:key cost:cost]; |
297 | } | 297 | } |
298 | 298 | ||
299 | - dispatch_main_sync_safe(^{ | 299 | + dispatch_async(dispatch_get_main_queue(), ^{ |
300 | doneBlock(diskImage, SDImageCacheTypeDisk); | 300 | doneBlock(diskImage, SDImageCacheTypeDisk); |
301 | }); | 301 | }); |
302 | } | 302 | } |
@@ -349,7 +349,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { | @@ -349,7 +349,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { | ||
349 | error:NULL]; | 349 | error:NULL]; |
350 | 350 | ||
351 | if (completion) { | 351 | if (completion) { |
352 | - dispatch_main_sync_safe(^{ | 352 | + dispatch_async(dispatch_get_main_queue(), ^{ |
353 | completion(); | 353 | completion(); |
354 | }); | 354 | }); |
355 | } | 355 | } |
@@ -486,7 +486,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { | @@ -486,7 +486,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { | ||
486 | } | 486 | } |
487 | 487 | ||
488 | if (completionBlock) { | 488 | if (completionBlock) { |
489 | - dispatch_main_sync_safe(^{ | 489 | + dispatch_async(dispatch_get_main_queue(), ^{ |
490 | completionBlock(fileCount, totalSize); | 490 | completionBlock(fileCount, totalSize); |
491 | }); | 491 | }); |
492 | } | 492 | } |
-
Please register or login to post a comment