changeset 2143:f7eeb54c6467 trunk

[svn] - changed playlist_shuffle_list to pick a playlist as parameter instead of calling playlist_get_active
author giacomo
date Sat, 16 Dec 2006 07:56:32 -0800
parents 959722e6e277
children b76039eeb6f0
files ChangeLog audacious/playlist.c
diffstat 2 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Dec 16 05:41:27 2006 -0800
+++ b/ChangeLog	Sat Dec 16 07:56:32 2006 -0800
@@ -1,3 +1,11 @@
+2006-12-16 13:41:27 +0000  Giacomo Lozito <james@develia.org>
+  revision [3289]
+  - clear and free a playlist passed to playlist_remove_playlist
+  trunk/audacious/playlist.c |    3 +++
+  trunk/audacious/playlist.h |    1 +
+  2 files changed, 4 insertions(+)
+
+
 2006-12-16 13:18:19 +0000  Giacomo Lozito <james@develia.org>
   revision [3287]
   added playlist_free and ensure that each created playlist is freed in mainwin_quit_cb; the list of playlists is freed there as well
--- a/audacious/playlist.c	Sat Dec 16 05:41:27 2006 -0800
+++ b/audacious/playlist.c	Sat Dec 16 07:56:32 2006 -0800
@@ -2085,7 +2085,7 @@
 }
 
 static GList *
-playlist_shuffle_list(GList * list)
+playlist_shuffle_list(Playlist *playlist, GList * list)
 {
     /*
      * Note that this doesn't make a copy of the original list.
@@ -2095,7 +2095,9 @@
     gint len = g_list_length(list);
     gint i, j;
     GList *node, **ptrs;
-    Playlist *playlist = playlist_get_active();
+
+    if (!playlist)
+        return NULL;
 
     REQUIRE_LOCK(playlist->mutex);
 
@@ -2130,7 +2132,7 @@
 playlist_random(Playlist *playlist)
 {
     PLAYLIST_LOCK(playlist->mutex);
-    playlist->entries = playlist_shuffle_list(playlist->entries);
+    playlist->entries = playlist_shuffle_list(playlist, playlist->entries);
     PLAYLIST_UNLOCK(playlist->mutex);
 }
 
@@ -2195,17 +2197,17 @@
     GList *node;
     gint numsongs;
 
-    REQUIRE_LOCK(playlist->mutex);
-
     if (!cfg.shuffle || !playlist)
         return;
 
+    REQUIRE_LOCK(playlist->mutex);
+
     if (playlist->shuffle) {
         g_list_free(playlist->shuffle);
         playlist->shuffle = NULL;
     }
 
-    playlist->shuffle = playlist_shuffle_list(g_list_copy(playlist->entries));
+    playlist->shuffle = playlist_shuffle_list(playlist, g_list_copy(playlist->entries));
     numsongs = g_list_length(playlist->shuffle);
 
     if (playlist->position) {