Mercurial > audlegacy
changeset 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 | 959722e6e277 |
files | ChangeLog audacious/mainwin.c audacious/playlist.c audacious/playlist.h |
diffstat | 4 files changed, 45 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Dec 16 04:49:16 2006 -0800 +++ b/ChangeLog Sat Dec 16 05:18:19 2006 -0800 @@ -1,3 +1,18 @@ +2006-12-16 12:49:16 +0000 Giacomo Lozito <james@develia.org> + revision [3285] + - made playlistwin_update_list depend on passed Playlist* instead of blindly using playlist_get_active(); this solves many locking issues with multiple playlists, but SHOULD be reviewed in every place playlistwin_update_list is used; added a playlist_new_from_selected() call too + trunk/audacious/mainwin.c | 4 - + trunk/audacious/playlist.c | 91 +++++++++++++++----------------- + trunk/audacious/playlist.h | 1 + trunk/audacious/prefswin.c | 12 ++-- + trunk/audacious/ui_playlist.c | 74 +++++++++++++------------- + trunk/audacious/ui_playlist.h | 3 - + trunk/audacious/util.c | 6 +- + trunk/audacious/widgets/playlist_list.c | 10 +-- + trunk/audacious/widgets/skin.c | 2 + 9 files changed, 101 insertions(+), 102 deletions(-) + + 2006-12-16 10:52:03 +0000 Giacomo Lozito <james@develia.org> revision [3283] - multiple playlist support requires separated locking; each Playlist holds its GMutex now; removed playlist_get function cause it doesn't fit with this scheme
--- 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);
--- a/audacious/playlist.c Sat Dec 16 04:49:16 2006 -0800 +++ b/audacious/playlist.c Sat Dec 16 05:18:19 2006 -0800 @@ -246,6 +246,12 @@ playlists_iter = playlists; } +GList * +playlist_get_playlists(void) +{ + return playlists; +} + void playlist_select_next(void) { @@ -2988,7 +2994,7 @@ } Playlist * -playlist_new(void) +playlist_new(void) { Playlist *playlist = g_new0(Playlist, 1); playlist->mutex = g_mutex_new(); @@ -3000,6 +3006,14 @@ return playlist; } +void +playlist_free(Playlist *playlist) +{ + g_mutex_free( playlist->mutex ); + g_free( playlist ); + return; +} + Playlist * playlist_new_from_selected(void) {
--- a/audacious/playlist.h Sat Dec 16 04:49:16 2006 -0800 +++ b/audacious/playlist.h Sat Dec 16 05:18:19 2006 -0800 @@ -99,10 +99,10 @@ void playlist_init(void); void playlist_add_playlist(Playlist *); void playlist_remove_playlist(Playlist *); - void playlist_select_playlist(Playlist *); void playlist_select_next(void); void playlist_select_prev(void); +GList * playlist_get_playlists(void); void playlist_clear(Playlist *playlist); void playlist_delete(Playlist *playlist, gboolean crop);