Skip to content

Commit

Permalink
Don't call dispatch_sync(main_queue) when already main thread (resolves
Browse files Browse the repository at this point in the history
  • Loading branch information
sbingner committed Mar 2, 2019
1 parent 874aa58 commit 0f424d1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Undecimus/source/JailbreakViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,15 @@ static inline void showAlertWithCancel(NSString *title, NSString *message, Boole
}

static inline void showAlert(NSString *title, NSString *message, Boolean wait, Boolean destructive) {
static bool outputIsHidden;
dispatch_sync(dispatch_get_main_queue(), ^{
__block bool outputIsHidden;
dispatch_block_t checkOutput = ^{
outputIsHidden = [[[JailbreakViewController sharedController] outputView] isHidden];
});
};

if ([NSThread mainThread]) {
checkOutput();
} else {
dispatch_sync(dispatch_get_main_queue(), checkOutput);
}
showAlertWithCancel(title, message, wait, destructive, outputIsHidden?nil:@"View Log");
}

0 comments on commit 0f424d1

Please sign in to comment.