]> git.sesse.net Git - vlc/commitdiff
playlist: Fix a possible dead lock when the playlist is killed.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 30 Mar 2008 17:02:00 +0000 (19:02 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 30 Mar 2008 17:02:00 +0000 (19:02 +0200)
We do maintain a lock around vlc_object_alive() because we want to make sure we won't miss the point when a concurrent thread will call vlc_object_kill(), that is set b_die and vlc_object_signal(). If we missed b_die and the signal, next vlc_object_wait() will dead lock.

src/playlist/thread.c

index 0d6919fa7e307bb98f01d1988a17ab2d3a071000..1a5061efe5777f4174ece1173d484ec14117b6eb 100644 (file)
@@ -155,6 +155,11 @@ static void RunControlThread ( playlist_t *p_playlist )
         playlist_MainLoop( p_playlist );
         PL_LOCK;
 
+        /* The playlist lock has been unlocked, so we can't tell if
+         * someone has killed us in the meantime. Check now. */
+        if( !vlc_object_alive( p_playlist ) )
+            break;
+
         if( p_playlist->b_cant_sleep )
         {
             /* 100 ms is an acceptable delay for playlist operations */