diff audacious/mainwin.c @ 2141:06a86fdd4fb7 trunk

[svn] added playlist_free and ensure that each created playlist is freed in mainwin_quit_cb; the list of playlists is freed there as well
author giacomo
date Sat, 16 Dec 2006 05:18:19 -0800
parents 299651a8f107
children a96b2e7ca58c
line wrap: on
line diff
--- a/audacious/mainwin.c	Sat Dec 16 04:49:16 2006 -0800
+++ b/audacious/mainwin.c	Sat Dec 16 05:18:19 2006 -0800
@@ -701,6 +701,8 @@
 void
 mainwin_quit_cb(void)
 {
+    GList *playlists = NULL, *playlists_top = NULL;
+
     gtk_widget_hide(equalizerwin);
     gtk_widget_hide(playlistwin);
     gtk_widget_hide(mainwin);
@@ -716,10 +718,20 @@
     ctrlsocket_cleanup();
 
     playlist_stop_get_info_thread();
-    playlist_clear(playlist_get_active());
+
+    /* free and clear each playlist */
+    playlists = playlist_get_playlists();
+    playlists_top = playlists;
+    while ( playlists != NULL )
+    {
+        playlist_clear((Playlist*)playlists->data);
+        playlist_free((Playlist*)playlists->data);
+        playlists = g_list_next(playlists);
+    }
+    g_list_free( playlists_top );
 
     plugin_system_cleanup();
-    
+
     gtk_main_quit();
 
     exit(EXIT_SUCCESS);