[vlc-devel] commit: Remove playlist items when destroying the playlist... ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jan 10 19:10:12 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jan 10 19:42:48 2009 +0200| [6914f254c1c18fee1afd2cda6fdeb5a60a71e9dc] | committer: Rémi Denis-Courmont 

Remove playlist items when destroying the playlist...

...rather than when disabling it. Otherwise service discovery plugins
cannot possibly cleanup after themselves (and CABOOM).

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

 src/playlist/engine.c |   18 ++++++++++++++++++
 src/playlist/thread.c |   16 ----------------
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index e1e9e11..b6f82ed 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -181,6 +181,24 @@ static void playlist_Destructor( vlc_object_t * p_this )
     assert( !p_sys->p_fetcher );
 
     vlc_cond_destroy( &p_sys->signal );
+
+    /* Remove all remaining items */
+    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, p_sys->items_to_delete )
+        free( p_del->pp_children );
+        vlc_gc_decref( p_del->p_input );
+        free( p_del );
+    FOREACH_END();
+    ARRAY_RESET( p_sys->items_to_delete );
+
+    ARRAY_RESET( p_playlist->items );
+    ARRAY_RESET( p_playlist->current );
+
     msg_Dbg( p_this, "Destroyed" );
 }
 
diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index 1d1a724..b2ad676 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -118,22 +118,6 @@ void playlist_Deactivate( playlist_t *p_playlist )
     /* 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, p_sys->items_to_delete )
-        free( p_del->pp_children );
-        vlc_gc_decref( p_del->p_input );
-        free( p_del );
-    FOREACH_END();
-    ARRAY_RESET( p_sys->items_to_delete );
-
-    ARRAY_RESET( p_playlist->items );
-    ARRAY_RESET( p_playlist->current );
-
     PL_UNLOCK;
 
     msg_Dbg( p_playlist, "Deactivated" );




More information about the vlc-devel mailing list