[vlc-devel] commit: Fixed too soon playlist items destruction. (Laurent Aimar )

git version control git at videolan.org
Mon Jan 5 21:26:43 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Dec 22 18:59:36 2008 +0100| [35f17389483e42d5454e88f7ce881f29d08f6f66] | committer: Laurent Aimar 

Fixed too soon playlist items destruction.

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

 src/playlist/engine.c |   39 +--------------------------------------
 src/playlist/thread.c |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index d3e8ffa..190442a 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -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 )
diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index 8792bc1..7759189 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -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" );




More information about the vlc-devel mailing list