[vlc-devel] [PATCH 5/5] macosx: Replace NSInvocation with dispatch_sync block
David Fuhrmann
david.fuhrmann at gmail.com
Mon Aug 7 23:45:31 CEST 2017
> Am 07.08.2017 um 21:57 schrieb Marvin Scholz <epirat07 at gmail.com>:
>
> ---
> 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)
>
Hi Marvin,
In general, patch series looks good to me.
If you happen to touch invocations onto the main thread: Could you also check that all passed objects / pointers are properly retained during transfer to the main thread? Mainly for vlc_objects they should be retained if they are passed.
Best regards,
David
More information about the vlc-devel
mailing list