Replacing #781 - based on http://blog.benjamin-encz.de/post/main-queue-vs-main-thread/, background queue can execute code on the main thread, so we need to check for the main queue to assure safety
This commit is contained in:
parent
2b721a6e30
commit
062e50aa10
|
@ -107,7 +107,7 @@ extern NSString *const SDWebImageErrorDomain;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define dispatch_main_async_safe(block)\
|
#define dispatch_main_async_safe(block)\
|
||||||
if ([NSThread isMainThread]) {\
|
if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(dispatch_get_main_queue())) == 0) {\
|
||||||
block();\
|
block();\
|
||||||
} else {\
|
} else {\
|
||||||
dispatch_async(dispatch_get_main_queue(), block);\
|
dispatch_async(dispatch_get_main_queue(), block);\
|
||||||
|
|
Loading…
Reference in New Issue