]> git.sesse.net Git - vlc/commitdiff
Remove playlist items when destroying the playlist...
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 10 Jan 2009 17:42:48 +0000 (19:42 +0200)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 10 Jan 2009 17:42:48 +0000 (19:42 +0200)
...rather than when disabling it. Otherwise service discovery plugins
cannot possibly cleanup after themselves (and CABOOM).

src/playlist/engine.c
src/playlist/thread.c

index e1e9e11deb0f4d0aad440ed8c4df453ab1f66a48..b6f82ed12a1b214dfa81c52b9c4c2cdb55c9df6d 100644 (file)
@@ -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" );
 }
 
index 1d1a724478b78fa2d0412cafbd276982b4cb20cb..b2ad6768f1841d504a0d548829594f2b1feba503 100644 (file)
@@ -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" );