[vlc-devel] [PATCH v2 2/4] macosx: wait until the View is removed from its parent in Close
Felix Paul Kühne
fkuehne at videolan.org
Tue Nov 3 10:06:45 CET 2020
Hello Steve,
> Am 03.11.2020 um 08:46 schrieb Steve Lhomme <robux4 at ycbcr.xyz>:
>
> ---
> modules/video_output/macosx.m | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
> index bcb71579d68..7143c2528fd 100644
> --- a/modules/video_output/macosx.m
> +++ b/modules/video_output/macosx.m
> @@ -46,6 +46,7 @@
> #include <vlc_vout_display.h>
> #include <vlc_opengl.h>
> #include <vlc_dialog.h>
> +#include <vlc_threads.h>
> #include "opengl/filter_draw.h"
> #include "opengl/renderer.h"
> #include "opengl/vout_helper.h"
> @@ -98,9 +99,12 @@ vlc_module_end ()
> vout_display_t *vd;
> vout_window_t *window;
> BOOL _hasPendingReshape;
> + vlc_sem_t removed;
> }
> - (void)setVoutWindow:(vout_window_t *)aWindow;
> - (void)setVoutDisplay:(vout_display_t *)vd;
> +- (void)didMoveToSuperview;
Nit-pick: Declaration not needed.
> +- (void)waitRemoved;
> - (void)setVoutFlushing:(BOOL)flushing;
> @end
>
> @@ -303,9 +307,11 @@ static void Close(vout_display_t *vd)
> /* release on main thread as explained in Open() */
> [viewContainer release];
> [glView removeFromSuperview];
> - [glView release];
> });
>
> + [glView waitRemoved];
> + [glView release];
> +
> free (sys);
> }
> }
> @@ -531,8 +537,22 @@ static void OpenglSwap (vlc_gl_t *gl)
> [self setFrame:[parentView bounds]];
> }
>
> +- (void)didMoveToSuperview:
> +{
> + if (superview != nil)
> + vlc_sem_wait(&removed); // not removed anymore
The comment reads a bit weird as you mean „is attached to a superview“
Best regards,
Felix
More information about the vlc-devel
mailing list