]> git.sesse.net Git - vlc/blobdiff - src/playlist/engine.c
playlist: Make sure we don't crash when we delete the currently playing node.
[vlc] / src / playlist / engine.c
index f6385d01e3a83f63e0d750f3f1ef4270aa39b50a..3631c1fb58d7b38133253aeb30e7c30c1f4ec92c 100644 (file)
@@ -477,6 +477,15 @@ void playlist_LastLoop( playlist_t *p_playlist )
         sout_DeleteInstance( p_sout );
 #endif
 
+    if( p_playlist->status.p_node &&
+        p_playlist->status.p_node->i_flags & PLAYLIST_REMOVE_FLAG )
+    {
+         PL_DEBUG( "%s was marked for deletion, deleting",
+                         PLI_NAME( p_playlist->status.p_node  ) );
+         playlist_ItemDelete( p_playlist->status.p_node );
+         p_playlist->status.p_node = NULL;
+    }
+
     /* Core should have terminated all SDs before the playlist */
     /* TODO: It fails to do so when not playing anything -- Courmisch */
     playlist_ServicesDiscoveryKillAll( p_playlist );