From 37ba81a540460a7d34a33c23d2353ac84f887576 Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Sat, 17 Aug 2013 20:06:59 +0000 Subject: Make more plug-ins use and implement RunOnMainThreadSync. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86706 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- .../plugins/Bladesio1/macsrc/PluginConfigController.m | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'macosx/plugins/Bladesio1/macsrc/PluginConfigController.m') 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; } -- cgit v1.2.3