[vlc-commits] macosx: Replace NSInvocation with dispatch_sync block

Marvin Scholz git at videolan.org
Wed Aug 9 00:22:53 CEST 2017


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Mon Aug  7 21:26:17 2017 +0200| [dce2a45ade6cb03012ae48010891c2c2dc34d5b9] | committer: Marvin Scholz

macosx: Replace NSInvocation with dispatch_sync block

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dce2a45ade6cb03012ae48010891c2c2dc34d5b9
---

 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);



More information about the vlc-commits mailing list