]> git.sesse.net Git - vlc/blobdiff - src/playlist/control.c
playlist: Don't allow pl_Release(p_playlist) and pl_Yield(p_playlist).
[vlc] / src / playlist / control.c
index fbbf9412e8ad450066807060f6b120338057a2cb..89ac8fbd3dd15c17e06b3a3084f652014afaa0a9 100644 (file)
@@ -47,6 +47,10 @@ playlist_t *__pl_Yield( vlc_object_t *p_this )
 
     barrier ();
     pl = libvlc_priv (p_this->p_libvlc)->p_playlist;
+
+    assert( pl != p_this /* This does not make sense to yield the playlist
+    using pl_Yield. use vlc_object_yield in this case */ );
+
     if (pl)
         vlc_object_yield (pl);
     return pl;
@@ -56,6 +60,10 @@ void __pl_Release( vlc_object_t *p_this )
 {
     playlist_t *pl = libvlc_priv (p_this->p_libvlc)->p_playlist;
     assert( pl != NULL );
+    
+    assert( pl != p_this /* The rule is that pl_Release() should act on
+    the same object than pl_Yield() */ );
+
     vlc_object_release( pl );
 }
 
@@ -65,10 +73,10 @@ int playlist_Control( playlist_t * p_playlist, int i_query,
     va_list args;
     int i_result;
     va_start( args, b_locked );
-    if( !b_locked ) PL_LOCK;
+    PL_LOCK_IF( !b_locked );
     i_result = PlaylistVAControl( p_playlist, i_query, args );
     va_end( args );
-    if( !b_locked ) PL_UNLOCK;
+    PL_UNLOCK_IF( !b_locked );
 
     return i_result;
 }