diff options
Diffstat (limited to 'macosx/plugins/Bladesio1/macsrc/PluginConfigController.m')
| -rwxr-xr-x | macosx/plugins/Bladesio1/macsrc/PluginConfigController.m | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m b/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m index 584f58a6..1090df6f 100755 --- a/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m +++ b/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m @@ -72,23 +72,27 @@ void AboutDlgProc() RELEASEOBJ(infoPaneDict); } +static inline void RunOnMainThreadSync(dispatch_block_t block) +{ + if ([NSThread isMainThread]) { + block(); + } else { + dispatch_sync(dispatch_get_main_queue(), block); + } +} + void ConfDlgProc() { __block NSWindow *window; __block PluginConfigController *tmpWindowController = nil; //We need this block due to the xib's use of auto layout - dispatch_block_t getWindowBlock = ^{ + RunOnMainThreadSync(^{ if (windowController == nil) { tmpWindowController = [[PluginConfigController alloc] initWithWindowNibName:@"Bladesio1PluginConfig"]; } window = [(windowController ? windowController : tmpWindowController) window]; - }; - if ([NSThread isMainThread]) { - getWindowBlock(); - } else { - dispatch_sync(dispatch_get_main_queue(), getWindowBlock); - } + }); if (!windowController) { windowController = tmpWindowController; } |
