[vlc-commits] playlist: assert lock on (non-NULL) VIEWPLAY control

Rémi Denis-Courmont git at videolan.org
Sat Nov 19 16:16:33 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov 19 17:15:43 2016 +0200| [06fcb250409e2cbe130c1a3b8ec19c91dc3bf129] | committer: Rémi Denis-Courmont

playlist: assert lock on (non-NULL) VIEWPLAY control

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

 src/playlist/control.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/playlist/control.c b/src/playlist/control.c
index b7469e0..2da525a 100644
--- a/src/playlist/control.c
+++ b/src/playlist/control.c
@@ -49,13 +49,14 @@ void playlist_AssertLocked( playlist_t *pl )
     vlc_assert_locked( &pl_priv(pl)->lock );
 }
 
-static void playlist_vaControl( playlist_t *p_playlist, int i_query, va_list args )
+static void playlist_vaControl( playlist_t *p_playlist, int i_query,
+                                bool locked, va_list args )
 {
-    PL_ASSERT_LOCKED;
+    PL_LOCK_IF( !locked );
 
     if( pl_priv(p_playlist)->killed )
-        return;
-
+        ;
+    else
     switch( i_query )
     {
     case PLAYLIST_STOP:
@@ -71,6 +72,8 @@ static void playlist_vaControl( playlist_t *p_playlist, int i_query, va_list arg
         playlist_item_t *p_node = va_arg( args, playlist_item_t * );
         playlist_item_t *p_item = va_arg( args, playlist_item_t * );
 
+        assert( locked || (p_item == NULL && p_node == NULL) );
+
         if ( p_node == NULL )
         {
             p_node = get_current_status_node( p_playlist );
@@ -121,26 +124,25 @@ static void playlist_vaControl( playlist_t *p_playlist, int i_query, va_list arg
 
     case PLAYLIST_PAUSE:
         if( pl_priv(p_playlist)->p_input == NULL )
-            return;
+            break;
         var_SetInteger( pl_priv(p_playlist)->p_input, "state", PAUSE_S );
         break;
 
     case PLAYLIST_RESUME:
         if( pl_priv(p_playlist)->p_input == NULL )
-            return;
+            break;
         var_SetInteger( pl_priv(p_playlist)->p_input, "state", PLAYING_S );
         break;
     }
     vlc_cond_signal( &pl_priv(p_playlist)->signal );
+    PL_UNLOCK_IF( !locked );
 }
 
 void playlist_Control( playlist_t *p_playlist, int query, bool locked, ... )
 {
     va_list args;
 
-    PL_LOCK_IF( !locked );
     va_start( args, locked );
-    playlist_vaControl( p_playlist, query, args );
+    playlist_vaControl( p_playlist, query, locked, args );
     va_end( args );
-    PL_UNLOCK_IF( !locked );
 }



More information about the vlc-commits mailing list