[vlc-devel] [PATCH 5/5] macosx: Replace NSInvocation with dispatch_sync block

Marvin Scholz epirat07 at gmail.com
Mon Aug 7 21:57:09 CEST 2017


---
 modules/gui/macosx/VLCVoutWindowController.m | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index 6460bf3d02..32fced7b89 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -65,18 +65,12 @@ int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
         }
         [voutController.lock lock];
 
-        SEL sel = @selector(setupVoutForWindow:withProposedVideoViewPosition:);
-        NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[voutController methodSignatureForSelector:sel]];
-        [inv setTarget:voutController];
-        [inv setSelector:sel];
-        [inv setArgument:&p_wnd atIndex:2]; // starting at 2!
-        [inv setArgument:&proposedVideoViewPosition atIndex:3];
-
-        [inv performSelectorOnMainThread:@selector(invoke) withObject:nil
-                           waitUntilDone:YES];
-
-        VLCVoutView *videoView = nil;
-        [inv getReturnValue:&videoView];
+        __block VLCVoutView *videoView = nil;
+
+        dispatch_sync(dispatch_get_main_queue(), ^{
+            videoView = [voutController setupVoutForWindow:p_wnd
+                             withProposedVideoViewPosition:proposedVideoViewPosition];
+        });
 
         // this method is not supposed to fail
         assert(videoView != nil);
-- 
2.11.0 (Apple Git-81)



More information about the vlc-devel mailing list