[vlc-devel] [PATCH] mkv: fixed broken locking mechanism

Steve Lhomme robux4 at gmail.com
Mon Mar 21 09:08:23 CET 2016


On Fri, Mar 18, 2016 at 7:30 PM, Filip Roséen <filip at videolabs.io> wrote:
> A temporary object (ie. an object without a name) is created in the
> expression in which it is introduced, and destroyed immediately after.

Oops!

> This means that the previous code did not lock p_sys->lock_demuxer for
> the remaining duration of the function "Demux", but instead _only_
> during the expression in which the temporary "vlc_mutex_locker" was
> constructed (ie. the locking and unlocking happened on that line).
>
> This patch fixes the issue by giving the previously unnamed object a
> name (binding its lifetime to the current scope).
> ---
>  modules/demux/mkv/mkv.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
> index 41da7e4..f6e29c2 100644
> --- a/modules/demux/mkv/mkv.cpp
> +++ b/modules/demux/mkv/mkv.cpp
> @@ -710,7 +710,7 @@ static int Demux( demux_t *p_demux)
>  {
>      demux_sys_t        *p_sys = p_demux->p_sys;
>
> -    vlc_mutex_locker( &p_sys->lock_demuxer );
> +    vlc_mutex_locker demux_lock ( &p_sys->lock_demuxer );
>
>      virtual_segment_c  *p_vsegment = p_sys->p_current_vsegment;
>
> --
> 2.7.3
>
> _______________________________________________
> 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