diff options
author | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2021-01-27 15:03:46 -0800 |
---|---|---|
committer | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2021-02-01 23:17:34 -0800 |
commit | 60ab67b6adf2b9324857ed8aa9acbbabb88fbdfd (patch) | |
tree | eee78fbc154f5e8e205e32bbb30fbd1220cd3438 | |
parent | a5c301c2a453c88e4b47b99636e84037630c9a38 (diff) | |
download | xserver-60ab67b6adf2b9324857ed8aa9acbbabb88fbdfd.tar.gz |
xquartz: Ensure that NSRunAlertPanel() is run on the main thread
Fixes: https://github.com/XQuartz/XQuartz/issues/30
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 520e7a1310ddc25b30bcaa0ea3eeaa6c4d137c8c)
-rw-r--r-- | hw/xquartz/X11Application.m | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 63b6c05fd..e745f53d7 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -1063,12 +1063,15 @@ X11ApplicationCanEnterRandR(void) if (!XQuartzIsRootless) QuartzShowFullscreen(FALSE); - switch (NSRunAlertPanel(title, @"%@", - NSLocalizedString(@"Allow", - @""), - NSLocalizedString(@"Cancel", - @""), - NSLocalizedString(@"Always Allow", @""), msg)) { + NSInteger __block alert_result; + dispatch_sync(dispatch_get_main_queue(), ^{ + alert_result = NSRunAlertPanel(title, @"%@", + NSLocalizedString(@"Allow", @""), + NSLocalizedString(@"Cancel", @""), + NSLocalizedString(@"Always Allow", @""), msg); + }); + + switch (alert_result) { case NSAlertOtherReturn: [X11App prefs_set_boolean:@PREFS_NO_RANDR_ALERT value:YES]; [X11App prefs_synchronize]; |