[vlc-devel] [PATCH] VLCVideoUIView: remove racy assert

Steve Lhomme robux4 at ycbcr.xyz
Mon Jan 4 07:58:36 UTC 2021


It seems the comment is more related to the assert than resetting the 
value of _wnd.

Couldn't this be an atomic boolean instead ? Because it seems the assert 
has some use. It's spotting improper use of the code, for example if 
it's refactored.

On 2020-12-24 9:35, Alexandre Janniaux wrote:
> _enabled is set asynchronously in the main thread whereas
> detachFromParent is called from the thread closing the window, which is
> usually different from the main thread. Checking _enabled here is racy
> and could lead to triggering the assertion.
> ---
>   modules/video_output/apple/VLCVideoUIView.m | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/modules/video_output/apple/VLCVideoUIView.m b/modules/video_output/apple/VLCVideoUIView.m
> index 4acbfff8ac..3a4c749816 100644
> --- a/modules/video_output/apple/VLCVideoUIView.m
> +++ b/modules/video_output/apple/VLCVideoUIView.m
> @@ -171,7 +171,6 @@
>       /* The UIView must not be attached before releasing. Disable() is doing
>        * exactly this asynchronously in the main thread so ensure it was called
>        * here before detaching from the parent. */
> -    assert(!_enabled);
>       _wnd = NULL;
>       vlc_mutex_unlock(&_mutex);
>   }
> -- 
> 2.29.2
> 
> _______________________________________________
> 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