Skip to content

Commit 2d8ade0

Browse files
authored
Merge pull request #3067 from quicksilver/fix_main_queue_crash
Use isMainThread to check if we're on the main thread
2 parents 8591887 + 35a9789 commit 2d8ade0

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • Quicksilver/Code-QuickStepFoundation

Quicksilver/Code-QuickStepFoundation/QSGCD.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ inline void QSGCDQueueDelayed(dispatch_queue_t queue, NSTimeInterval delay, void
3333

3434
inline void QSGCDMainSync(void (^block)(void))
3535
{
36-
QSGCDQueueSync(dispatch_get_main_queue(), block);
36+
if ([NSThread isMainThread]) {
37+
block();
38+
} else {
39+
dispatch_sync(dispatch_get_main_queue(), block);
40+
}
3741
}
3842

3943
inline void QSGCDMainAsync(void (^block)(void))

0 commit comments

Comments
 (0)