Skip to content
Permalink
Browse files

#3213: Fix crash caused by c37bea8.

  • Loading branch information
stuconnolly committed Oct 10, 2018
1 parent 582885a commit 102f6efbb20e86173e85974beadf2dc84dc7d694
Showing with 10 additions and 2 deletions.
  1. +10 −2 Source/SPAlertSheets.m
@@ -30,6 +30,7 @@

#import "SPAlertSheets.h"
#import "SPMainThreadTrampoline.h"
#import "SPFunctions.h"

@implementation SPAlertSheets

@@ -207,7 +208,7 @@ void SPBeginAlertSheet(
void *contextInfo,
NSString *msg)
{
dispatch_sync(dispatch_get_main_queue(), ^{
void (^alertBlock)(void) = ^{
// Set up an NSAlert with the supplied details
NSAlert *alert = [[[NSAlert alloc] init] autorelease];

@@ -236,5 +237,12 @@ void SPBeginAlertSheet(

// Ensure the alerting window is frontmost
[docWindow makeKeyWindow];
});
};

if (dispatch_get_current_queue() == dispatch_get_main_queue()) {
alertBlock();
}
else {
dispatch_sync(dispatch_get_main_queue(), alertBlock);
}
}

2 comments on commit 102f6ef

@dmoagx

This comment has been minimized.

Copy link
Member

@dmoagx dmoagx replied Oct 11, 2018

Why not use the SPMainQSync function?

@stuconnolly

This comment has been minimized.

Copy link
Member Author

@stuconnolly stuconnolly replied Oct 11, 2018

Yep, I was being lazy. Adding a reference to SPFunctions broke the tunnel assistant build, which I've just realised is because I forgot to include it in the sources to compile. Will get it updated.

Please sign in to comment.
You can’t perform that action at this time.