[vlc-commits] access: bluray: do proper locking in stopBackground

Francois Cartegnie git at videolan.org
Tue Oct 23 22:37:11 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Oct 23 11:03:22 2018 +0200| [d9f137837172f2f5e591fb32aabfe48cb4949c18] | committer: Francois Cartegnie

access: bluray: do proper locking in stopBackground

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

 modules/access/bluray.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 5dd8e6a360..80a45249e9 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -600,7 +600,11 @@ static void stopBackground(demux_t *p_demux)
 {
     demux_sys_t *p_sys = p_demux->p_sys;
 
-    if (!p_sys->bdj.p_dummy_video) {
+    vlc_mutex_lock(&p_sys->bdj.lock);
+
+    if (!p_sys->bdj.p_dummy_video)
+    {
+        vlc_mutex_unlock(&p_sys->bdj.lock);
         return;
     }
 
@@ -608,12 +612,11 @@ static void stopBackground(demux_t *p_demux)
 
     es_out_Del(p_demux->out, p_sys->bdj.p_dummy_video);
 
-    vlc_mutex_lock(&p_sys->bdj.lock);
     if (p_sys->bdj.p_video_es == p_sys->bdj.p_dummy_video)
         blurayReleaseVideoES(p_demux);
-    vlc_mutex_unlock(&p_sys->bdj.lock);
-
     p_sys->bdj.p_dummy_video = NULL;
+
+    vlc_mutex_unlock(&p_sys->bdj.lock);
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list