]> git.sesse.net Git - vlc/commitdiff
Fixed too soon playlist items destruction.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 22 Dec 2008 17:59:36 +0000 (18:59 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 5 Jan 2009 19:49:06 +0000 (20:49 +0100)
src/playlist/engine.c
src/playlist/thread.c

index d3e8ffa6bf6b7e6741cc729df86ae7d5815cde50..190442ad7d9b765e5b1a0a940af32372ea39602f 100644 (file)
@@ -177,6 +177,7 @@ static void playlist_Destructor( vlc_object_t * p_this )
     playlist_t *p_playlist = (playlist_t *)p_this;
     playlist_private_t *p_sys = pl_priv(p_playlist);
 
+    assert( !p_sys->p_sout );
     assert( !p_sys->p_preparser );
     assert( !p_sys->p_fetcher );
 
@@ -496,44 +497,6 @@ void playlist_LastLoop( playlist_t *p_playlist )
 
         msleep( INTF_IDLE_SLEEP );
     }
-
-#ifdef ENABLE_SOUT
-    /* close the remaining sout-keep (if there was no input atm) */
-    sout_instance_t *p_sout = pl_priv(p_playlist)->p_sout;
-    if (p_sout)
-        sout_DeleteInstance( p_sout );
-#endif
-
-    /* Core should have terminated all SDs before the playlist */
-    /* TODO: It fails to do so when not playing anything -- Courmisch */
-    playlist_ServicesDiscoveryKillAll( p_playlist );
-    playlist_MLDump( p_playlist );
-
-    PL_LOCK;
-
-    /* Release the current node */
-    set_current_status_node( p_playlist, NULL );
-
-    /* Release the current item */
-    set_current_status_item( p_playlist, NULL );
-
-    FOREACH_ARRAY( playlist_item_t *p_del, p_playlist->all_items )
-        free( p_del->pp_children );
-        vlc_gc_decref( p_del->p_input );
-        free( p_del );
-    FOREACH_END();
-    ARRAY_RESET( p_playlist->all_items );
-    FOREACH_ARRAY( playlist_item_t *p_del, pl_priv(p_playlist)->items_to_delete )
-        free( p_del->pp_children );
-        vlc_gc_decref( p_del->p_input );
-        free( p_del );
-    FOREACH_END();
-    ARRAY_RESET( pl_priv(p_playlist)->items_to_delete );
-
-    ARRAY_RESET( p_playlist->items );
-    ARRAY_RESET( p_playlist->current );
-
-    PL_UNLOCK;
 }
 
 static void VariablesInit( playlist_t *p_playlist )
index 8792bc181674f4cb3bde023949c64d03fbbbd3ba..7759189a4df63f036ee91b112fa1056eec52ca0e 100644 (file)
@@ -30,6 +30,7 @@
 #include <vlc_input.h>
 #include <vlc_interface.h>
 #include <vlc_playlist.h>
+#include "stream_output/stream_output.h"
 #include "playlist_internal.h"
 
 /*****************************************************************************
@@ -87,7 +88,41 @@ void playlist_Deactivate( playlist_t *p_playlist )
     if( p_sys->p_fetcher )
         playlist_fetcher_Delete( p_sys->p_fetcher );
 
+    /* close the remaining sout-keep */
+    if( p_sys->p_sout )
+        sout_DeleteInstance( p_sys->p_sout );
+
+    /* */
+    playlist_MLDump( p_playlist );
+
+    PL_LOCK;
+
+    /* Release the current node */
+    set_current_status_node( p_playlist, NULL );
+
+    /* Release the current item */
+    set_current_status_item( p_playlist, NULL );
+
+    FOREACH_ARRAY( playlist_item_t *p_del, p_playlist->all_items )
+        free( p_del->pp_children );
+        vlc_gc_decref( p_del->p_input );
+        free( p_del );
+    FOREACH_END();
+    ARRAY_RESET( p_playlist->all_items );
+    FOREACH_ARRAY( playlist_item_t *p_del, pl_priv(p_playlist)->items_to_delete )
+        free( p_del->pp_children );
+        vlc_gc_decref( p_del->p_input );
+        free( p_del );
+    FOREACH_END();
+    ARRAY_RESET( pl_priv(p_playlist)->items_to_delete );
+
+    ARRAY_RESET( p_playlist->items );
+    ARRAY_RESET( p_playlist->current );
+
+    PL_UNLOCK;
+
     /* The NULL are there only to assert in playlist destructor */
+    p_sys->p_sout = NULL;
     p_sys->p_preparser = NULL;
     p_sys->p_fetcher = NULL;
     msg_Err( p_playlist, "Deactivated" );