[vlc-commits] mkv: fixed broken locking mechanism

Filip Roséen git at videolan.org
Fri Mar 18 19:44:27 CET 2016


vlc | branch: master | Filip Roséen <filip at videolabs.io> | Fri Mar 18 19:30:02 2016 +0100| [623bb996c6c13a231e3065a74d4233e4e00d0ec2] | committer: Jean-Baptiste Kempf

mkv: fixed broken locking mechanism

A temporary object (ie. an object without a name) is created in the
expression in which it is introduced, and destroyed immediately after.

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).

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=623bb996c6c13a231e3065a74d4233e4e00d0ec2
---

 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;
 



More information about the vlc-commits mailing list