[vlc-commits] commit: dvdnav: fully fix the still image assertion ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Thu Apr 15 18:13:06 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Apr 15 19:10:12 2010 +0300| [b28c362339ac8ef7f3b9b1715631f304e7563418] | committer: Rémi Denis-Courmont 

dvdnav: fully fix the still image assertion

This completes 24ae7ed55e206a37571d0d39a3d21353936f9a64. Even if the
timer is removed from the schedule, there is no warranty that it's not
pending execution, or waiting on our mutex, at the very moment.
So there is a small window of opportunity for the assertion to fail.

This removes the assertion in favor of a safer if(likely()).

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

 modules/access/dvdnav.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 083f716..b8d4eb6 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -1259,9 +1259,11 @@ static void StillTimer( void *p_data )
     demux_sys_t    *p_sys = p_data;
 
     vlc_mutex_lock( &p_sys->still.lock );
-    assert( p_sys->still.b_enabled );
-    p_sys->still.b_enabled = false;
-    dvdnav_still_skip( p_sys->dvdnav );
+    if( likely(p_sys->still.b_enabled) )
+    {
+        p_sys->still.b_enabled = false;
+        dvdnav_still_skip( p_sys->dvdnav );
+    }
     vlc_mutex_unlock( &p_sys->still.lock );
 }
 



More information about the vlc-commits mailing list