[vlc-devel] [PATCH] vout/macosx: simplify close and make sure all AppKit objects are released on the main thread
Thomas Guillem
thomas at gllm.fr
Thu Sep 19 18:21:19 CEST 2019
OK for me.
Nitpick: you could shorten the commit title.
commit title: "vout/macosx: simplify close"
commit message: "And make sure all AppKit objects are released on the main thread"
On Thu, Sep 19, 2019, at 18:10, Felix Paul Kühne wrote:
> From: Felix Paul Kühne <felix at feepk.net>
>
> Note that this does _not_ solve #22766.
> ---
> modules/video_output/macosx.m | 29 ++++++++++++++---------------
> 1 file changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
> index 6290bbf763..edc793b2d5 100644
> --- a/modules/video_output/macosx.m
> +++ b/modules/video_output/macosx.m
> @@ -265,21 +265,8 @@ static void Close(vout_display_t *vd)
> [sys->glView setVoutDisplay:nil];
>
> var_Destroy (vd, "drawable-nsobject");
> - if ([(id)sys->container
> respondsToSelector:@selector(removeVoutSubview:)])
> - /* This will retain sys->glView */
> - [(id)sys->container
> performSelectorOnMainThread:@selector(removeVoutSubview:)
> - withObject:sys->glView
> - waitUntilDone:NO];
> -
> - /* release on main thread as explained in Open() */
> - [(id)sys->container
> performSelectorOnMainThread:@selector(release)
> - withObject:nil
> - waitUntilDone:NO];
> - [sys->glView
> performSelectorOnMainThread:@selector(removeFromSuperview)
> - withObject:nil
> - waitUntilDone:NO];
> -
> var_Destroy(vlc_object_parent(vd), "macosx-glcontext");
> +
> if (sys->vgl != NULL)
> {
> vlc_gl_MakeCurrent(sys->gl);
> @@ -294,7 +281,19 @@ static void Close(vout_display_t *vd)
> vlc_object_delete(sys->gl);
> }
>
> - [sys->glView release];
> + VLCOpenGLVideoView *glView = sys->glView;
> + id<VLCVideoViewEmbedding> viewContainer = sys->container;
> + dispatch_async(dispatch_get_main_queue(), ^{
> + if ([viewContainer
> respondsToSelector:@selector(removeVoutSubview:)]) {
> + /* This will retain sys->glView */
> + [viewContainer removeVoutSubview:sys->glView];
> + }
> +
> + /* release on main thread as explained in Open() */
> + [viewContainer release];
> + [glView removeFromSuperview];
> + [glView release];
> + });
>
> free (sys);
> }
> --
> 2.20.1 (Apple Git-117)
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list