changeset 2140:299651a8f107 trunk

[svn] - 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
author giacomo
date Sat, 16 Dec 2006 04:49:16 -0800
parents fcd1f54efdb9
children 06a86fdd4fb7
files ChangeLog audacious/mainwin.c audacious/playlist.c audacious/playlist.h audacious/prefswin.c audacious/ui_playlist.c audacious/ui_playlist.h audacious/util.c audacious/widgets/playlist_list.c audacious/widgets/skin.c
diffstat 10 files changed, 113 insertions(+), 103 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Dec 16 02:52:03 2006 -0800
+++ b/ChangeLog	Sat Dec 16 04:49:16 2006 -0800
@@ -1,3 +1,14 @@
+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
+  trunk/audacious/mainwin.c               |   51 +--
+  trunk/audacious/playlist.c              |  447 ++++++++++++++++----------------
+  trunk/audacious/playlist.h              |    9 
+  trunk/audacious/ui_playlist.c           |   67 +++-
+  trunk/audacious/widgets/playlist_list.c |   36 +-
+  5 files changed, 330 insertions(+), 280 deletions(-)
+
+
 2006-12-16 10:35:16 +0000  Jerome Poulin <ticpu@ticpu.net>
   revision [3281]
   Added playback-seek{-relative} in audtool.1 man page.
--- a/audacious/mainwin.c	Sat Dec 16 02:52:03 2006 -0800
+++ b/audacious/mainwin.c	Sat Dec 16 04:49:16 2006 -0800
@@ -2273,7 +2273,7 @@
 
         cfg.playlist_font = g_strconcat(decoded, strrchr(cfg.playlist_font, ' '), NULL);
         playlist_list_set_font(cfg.playlist_font);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist);
 
         g_free(decoded);
 
@@ -3971,7 +3971,7 @@
         G_UNLOCK(mainwin_title);
 
         mainwin_set_info_text();
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
     }
 
     /* tristate buttons seek */
--- a/audacious/playlist.c	Sat Dec 16 02:52:03 2006 -0800
+++ b/audacious/playlist.c	Sat Dec 16 04:49:16 2006 -0800
@@ -83,7 +83,6 @@
  *
  * January 7, 2006, William Pitcock <nenolod@nenolod.net>
  */
-static gboolean loading_playlist = FALSE;
 
 G_LOCK_DEFINE(playlist_get_info_going);
 
@@ -258,7 +257,7 @@
     if (playlists_iter == NULL)
         playlists_iter = playlists;
 
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
 }
 
 void
@@ -272,7 +271,7 @@
     if (playlists_iter == NULL)
         playlists_iter = playlists;
 
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
 }
 
 void
@@ -286,7 +285,7 @@
     if (playlists_iter == NULL)
         playlists_iter = playlists;
 
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 }
 
 /* *********************** playlist code ********************** */
@@ -346,12 +345,7 @@
 playlist_clear(Playlist *playlist)
 {
     if (!playlist)
-    {
-        playlist_generate_shuffle_list(playlist);
-        playlistwin_update_list();
-        playlist_recalc_total_time(playlist);
         return;
-    }
 
     PLAYLIST_LOCK( playlist->mutex );
 
@@ -363,7 +357,7 @@
     PLAYLIST_UNLOCK( playlist->mutex );
 
     playlist_generate_shuffle_list(playlist);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
 }
 
@@ -447,7 +441,7 @@
 
     playlist_recalc_total_time(playlist);
 
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
     if (restart_playing) {
         if (playlist->position) {
             bmp_playback_initiate();
@@ -486,7 +480,7 @@
     playlist_recalc_total_time(playlist);
     PLAYLIST_UNLOCK(playlist->mutex);
 
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 
     if (restart_playing) {
         if (playlist->position) {
@@ -544,7 +538,7 @@
         }
     }
 
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 }
 
 static void
@@ -626,22 +620,22 @@
     g_return_val_if_fail(filename != NULL, FALSE);
 
     if (is_playlist_name(filename)) {
-        loading_playlist = TRUE;
+        playlist->loading_playlist = TRUE;
         playlist_load_ins(playlist, filename, pos);
-        loading_playlist = FALSE;
+        playlist->loading_playlist = FALSE;
         return TRUE;
     }
 
-    if (loading_playlist == TRUE || cfg.playlist_detect == TRUE)
+    if (playlist->loading_playlist == TRUE || cfg.playlist_detect == TRUE)
 	dec = NULL;
     else
 	dec = input_check_file(filename, TRUE);
 
-    if (cfg.playlist_detect == TRUE || loading_playlist == TRUE || (loading_playlist == FALSE && dec != NULL))
+    if (cfg.playlist_detect == TRUE || playlist->loading_playlist == TRUE || (playlist->loading_playlist == FALSE && dec != NULL))
     {
 	__playlist_ins(playlist, filename, pos, dec);
 	playlist_generate_shuffle_list(playlist);
-	playlistwin_update_list();
+	playlistwin_update_list(playlist);
         return TRUE;
     }
 
@@ -845,7 +839,7 @@
 
     playlist_recalc_total_time(playlist);
     playlist_generate_shuffle_list(playlist);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
     return entries;
 }
 
@@ -863,7 +857,7 @@
     g_return_val_if_fail(playlist != NULL, 0);
     g_return_val_if_fail(string != NULL, 0);
 
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 
     while (*string) {
         GList *node;
@@ -912,7 +906,7 @@
 
     playlist_recalc_total_time(playlist);
     playlist_generate_shuffle_list(playlist);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 
     return entries;
 }
@@ -1044,7 +1038,7 @@
         bmp_playback_initiate();
     else {
         mainwin_set_info_text();
-        playlistwin_update_list();
+        playlistwin_update_list(playlist);
     }
 }
 
@@ -1106,7 +1100,7 @@
         bmp_playback_initiate();
     else {
         mainwin_set_info_text();
-        playlistwin_update_list();
+        playlistwin_update_list(playlist);
     }
 }
 
@@ -1145,7 +1139,7 @@
     PLAYLIST_UNLOCK(playlist->mutex);
 
     playlist_recalc_total_time(playlist);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 }
 
 void
@@ -1172,7 +1166,7 @@
     PLAYLIST_UNLOCK(playlist->mutex);
 
     playlist_recalc_total_time(playlist);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 }
 
 gboolean
@@ -1226,7 +1220,7 @@
     PLAYLIST_UNLOCK(playlist->mutex);
 
     playlist_recalc_total_time(playlist);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 }
 
 void
@@ -1239,7 +1233,7 @@
     playlist->queue = g_list_remove(playlist->queue, entry);
     PLAYLIST_UNLOCK(playlist->mutex);
 
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 }
 
 gint
@@ -1289,7 +1283,7 @@
         bmp_playback_initiate();
     else {
         mainwin_set_info_text();
-        playlistwin_update_list();
+        playlistwin_update_list(playlist);
     }
 }
 
@@ -1355,7 +1349,7 @@
     playlist_check_pos_current(playlist);
     bmp_playback_initiate();
     mainwin_set_info_text();
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 }
 
 gint
@@ -1484,10 +1478,11 @@
 playlist_load(Playlist * playlist, const gchar * filename)
 {
     gboolean ret = FALSE;
-
-    loading_playlist = TRUE;
+    g_return_val_if_fail(playlist != NULL, FALSE);
+
+    playlist->loading_playlist = TRUE;
     ret = playlist_load_ins(playlist, filename, -1);
-    loading_playlist = FALSE;
+    playlist->loading_playlist = FALSE;
 
     return ret;
 }
@@ -1503,6 +1498,7 @@
     InputPlugin *dec;		/* for decoder cache */
 
     g_return_if_fail(filename_p != NULL);
+    g_return_if_fail(playlist != NULL);
     g_return_if_fail(playlist_name != NULL);
 
     filename = g_strchug(g_strdup(filename_p));
@@ -1516,7 +1512,7 @@
         if ((tmp = strrchr(path, '/')))
             *tmp = '\0';
         else {
-	    if (loading_playlist != TRUE || cfg.playlist_detect == FALSE)
+	    if (playlist->loading_playlist != TRUE || cfg.playlist_detect == FALSE)
 	        dec = input_check_file(filename, FALSE);
 	    else
 		dec = NULL;
@@ -1526,7 +1522,7 @@
         }
         tmp = g_build_filename(path, filename, NULL);
 
-	if (loading_playlist != TRUE && cfg.playlist_detect != TRUE)
+	if (playlist->loading_playlist != TRUE && cfg.playlist_detect != TRUE)
 	    dec = input_check_file(tmp, FALSE);
 	else
 	    dec = NULL;
@@ -1537,7 +1533,7 @@
     }
     else
     {
-	if (loading_playlist != TRUE && cfg.playlist_detect != TRUE)
+	if (playlist->loading_playlist != TRUE && cfg.playlist_detect != TRUE)
 	    dec = input_check_file(filename, FALSE);
 	else
 	    dec = NULL;
@@ -1561,6 +1557,7 @@
 
     g_return_if_fail(filename_p != NULL);
     g_return_if_fail(playlist_name != NULL);
+    g_return_if_fail(playlist != NULL);
 
     filename = g_strchug(g_strdup(filename_p));
 
@@ -1572,7 +1569,7 @@
         if ((tmp = strrchr(path, '/')))
             *tmp = '\0';
         else {
-	    if (loading_playlist != TRUE || cfg.playlist_detect == FALSE)
+	    if (playlist->loading_playlist != TRUE || cfg.playlist_detect == FALSE)
 	        dec = input_check_file(filename, FALSE);
 	    else
 		dec = NULL;
@@ -1582,7 +1579,7 @@
         }
         tmp = g_build_filename(path, filename, NULL);
 
-	if (loading_playlist != TRUE && cfg.playlist_detect != TRUE)
+	if (playlist->loading_playlist != TRUE && cfg.playlist_detect != TRUE)
 	    dec = input_check_file(tmp, FALSE);
 	else
 	    dec = NULL;
@@ -1593,7 +1590,7 @@
     }
     else
     {
-	if (loading_playlist != TRUE && cfg.playlist_detect != TRUE)
+	if (playlist->loading_playlist != TRUE && cfg.playlist_detect != TRUE)
 	    dec = input_check_file(filename, FALSE);
 	else
 	    dec = NULL;
@@ -1622,7 +1619,7 @@
     plc->plc_read(filename, pos);
 
     playlist_generate_shuffle_list(playlist);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 
     return 1;
 }
@@ -2412,7 +2409,7 @@
         }
 
         if (update_playlistwin) {
-            playlistwin_update_list();
+            playlistwin_update_list(playlist);
             update_playlistwin = FALSE;
         }
 
@@ -2509,7 +2506,7 @@
     PLAYLIST_UNLOCK(playlist->mutex);
     
     playlist_generate_shuffle_list(playlist);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
 }
 
@@ -2642,7 +2639,7 @@
 
     PLAYLIST_UNLOCK(playlist->mutex);
 
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
 }
 
@@ -2938,7 +2935,7 @@
 
     PLAYLIST_UNLOCK(playlist->mutex);
 
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
 
     return retval;
@@ -2960,7 +2957,7 @@
 
     PLAYLIST_UNLOCK(playlist->mutex);
 
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
 }
 
@@ -2995,6 +2992,7 @@
 {
     Playlist *playlist = g_new0(Playlist, 1);
     playlist->mutex = g_mutex_new();
+    playlist->loading_playlist = FALSE;
 
     playlist_set_current_name(playlist, NULL);
     playlist_clear(playlist);
@@ -3005,12 +3003,12 @@
 Playlist *
 playlist_new_from_selected(void)
 {
-#if 0
- /* !!!!!! TODO !!!!!!! */
     Playlist *newpl = playlist_new();
     Playlist *playlist = playlist_get_active();
     GList *list = playlist_get_selected(playlist);
 
+    playlist_add_playlist( newpl );
+
     PLAYLIST_LOCK(playlist->mutex);
 
     while ( list != NULL )
@@ -3024,8 +3022,7 @@
     PLAYLIST_UNLOCK(playlist->mutex);
 
     playlist_recalc_total_time(newpl);
-    playlistwin_update_list();
-#endif
+    playlistwin_update_list(playlist);
 }
 
 const gchar *
--- a/audacious/playlist.h	Sat Dec 16 02:52:03 2006 -0800
+++ b/audacious/playlist.h	Sat Dec 16 04:49:16 2006 -0800
@@ -75,6 +75,7 @@
     gulong         pl_selection_time;
     gboolean       pl_total_more;
     gboolean       pl_selection_more;
+    gboolean       loading_playlist;
     GMutex        *mutex;       /* this is required for multiple playlist */
 } Playlist;
 
--- a/audacious/prefswin.c	Sat Dec 16 02:52:03 2006 -0800
+++ b/audacious/prefswin.c	Sat Dec 16 04:49:16 2006 -0800
@@ -908,7 +908,7 @@
     mainwin_set_info_text();
     draw_main_window(TRUE);
     if (cfg.playlist_shaded) {
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         draw_playlist_window(TRUE);
     }
 }
@@ -929,7 +929,7 @@
 
     playlist_list_set_font(cfg.playlist_font);
     playlistwin_set_sinfo_font(cfg.playlist_font);  /* propagate font setting to playlistwin_sinfo */
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
     draw_playlist_window(TRUE);
 }
 
@@ -952,7 +952,7 @@
                                     gpointer data)
 {
     cfg.show_numbers_in_pl = gtk_toggle_button_get_active(button);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
     draw_playlist_window(TRUE);
 }
 
@@ -968,7 +968,7 @@
                                     gpointer data)
 {
     cfg.playlist_transparent = gtk_toggle_button_get_active(button);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
     draw_playlist_window(TRUE);
 }
 
@@ -984,7 +984,7 @@
                                     gpointer data)
 {
     cfg.show_separator_in_pl = gtk_toggle_button_get_active(button);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
     draw_playlist_window(TRUE);
 }
 
@@ -1881,7 +1881,7 @@
                                     strrchr(cfg.playlist_font, ' '),
                                     NULL);
     playlist_list_set_font(cfg.playlist_font);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
     gtk_font_button_set_font_name(user_data, cfg.playlist_font);	
     
     g_free(decoded);
--- a/audacious/ui_playlist.c	Sat Dec 16 02:52:03 2006 -0800
+++ b/audacious/ui_playlist.c	Sat Dec 16 04:49:16 2006 -0800
@@ -338,13 +338,13 @@
 }
 
 static void
-playlistwin_update_info(void)
+playlistwin_update_info(Playlist *playlist)
 {
     gchar *text, *sel_text, *tot_text;
     gulong selection, total;
     gboolean selection_more, total_more;
 
-    playlist_get_total_time(playlist_get_active(), &total, &selection, &total_more, &selection_more);
+    playlist_get_total_time(playlist, &total, &selection, &total_more, &selection_more);
 
     if (selection > 0 || (selection == 0 && !selection_more)) {
         if (selection > 3600)
@@ -380,11 +380,10 @@
 }
 
 static void
-playlistwin_update_sinfo(void)
+playlistwin_update_sinfo(Playlist *playlist)
 {
     gchar *posstr, *timestr, *title, *info;
     gint pos, time;
-    Playlist *playlist = playlist_get_active();
 
     pos = playlist_get_position(playlist);
     title = playlist_get_songtitle(playlist, pos);
@@ -443,18 +442,18 @@
 {
     if (playlistwin_list)
         playlistwin_list->pl_first = toprow;
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
 }
 
 void
-playlistwin_update_list(void)
+playlistwin_update_list(Playlist *playlist)
 {
     g_return_if_fail(playlistwin_list != NULL);
 
     widget_draw(WIDGET(playlistwin_list));
     widget_draw(WIDGET(playlistwin_slider));
-    playlistwin_update_info();
-    playlistwin_update_sinfo();
+    playlistwin_update_info(playlist);
+    playlistwin_update_sinfo(playlist);
     /*     mainwin_update_jtf(); */
 }
 
@@ -605,7 +604,7 @@
     gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), shaded);
 
     playlistwin_set_shade(shaded);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
 }
 
 void
@@ -631,7 +630,7 @@
        dock_move_release(GTK_WINDOW(playlistwin));
 
        if (cfg.playlist_transparent)
-           playlistwin_update_list();
+           playlistwin_update_list(playlist_get_active());
     }
     else
     {
@@ -644,7 +643,7 @@
 playlistwin_scroll(gint num)
 {
     playlistwin_list->pl_first += num;
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
 }
 
 void
@@ -668,7 +667,7 @@
     playlistwin_list->pl_prev_selected = 0;
     playlistwin_list->pl_prev_min = 0;
     playlistwin_list->pl_prev_max = playlist_get_length(playlist) - 1;
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 }
 
 static void
@@ -677,7 +676,7 @@
     playlist_select_all(playlist_get_active(), FALSE);
     playlistwin_list->pl_prev_selected = -1;
     playlistwin_list->pl_prev_min = -1;
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
 }
 
 static void
@@ -789,7 +788,7 @@
          if ( tuple->performer != NULL ) g_free( tuple->performer );
          if ( tuple->file_name != NULL ) g_free( tuple->file_name );
          g_free( tuple );
-         playlistwin_update_list();
+         playlistwin_update_list(playlist_get_active());
          /* check if a new playlist should be created after searching */
          if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist)) == TRUE )
              playlist_new_from_selected();
@@ -808,7 +807,7 @@
     playlist_select_invert_all(playlist_get_active());
     playlistwin_list->pl_prev_selected = -1;
     playlistwin_list->pl_prev_min = -1;
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
 }
 
 static void
@@ -834,7 +833,7 @@
     widget_resize(WIDGET(playlistwin_slider), 8, height - 58);
 
     widget_resize(WIDGET(playlistwin_sinfo), width - 35, 14);
-    playlistwin_update_sinfo();
+    playlistwin_update_sinfo(playlist_get_active());
 
     widget_move(WIDGET(playlistwin_shade), width - 21, 3);
     widget_move(WIDGET(playlistwin_close), width - 11, 3);
@@ -1608,7 +1607,7 @@
 
     if (refresh) {
         g_cond_signal(cond_scan);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
     }
 
     return TRUE;
@@ -1714,7 +1713,7 @@
     playlistwin_list->pl_drag_motion = TRUE;
     playlistwin_list->drag_motion_x = x;
     playlistwin_list->drag_motion_y = y;
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
     playlistwin_hint_flag = TRUE;
 }
 
@@ -1724,7 +1723,7 @@
 {
     playlistwin_list->pl_drag_motion = FALSE;
     playlistwin_hint_flag = FALSE;
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
 }
 
 static void
@@ -2023,6 +2022,7 @@
 void
 playlistwin_create(void)
 {
+    Playlist *playlist;
     playlistwin_create_window();
     playlistwin_create_popup_menus();
 
@@ -2034,7 +2034,7 @@
     gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0);
 
     playlistwin_create_widgets();
-    playlistwin_update_info();
+    playlistwin_update_info(playlist_get_active());
 
     gtk_window_add_accel_group(GTK_WINDOW(playlistwin), playlistwin_accel);
     gtk_window_add_accel_group(GTK_WINDOW(playlistwin), mainwin_accel);
@@ -2087,67 +2087,67 @@
     switch (action) {
     case PLAYLISTWIN_SORT_BYPLAYLIST:
         playlist_sort(playlist, PLAYLIST_SORT_PLAYLIST);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_BYTRACK:
         playlist_sort(playlist, PLAYLIST_SORT_TRACK);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_BYTITLE:
         playlist_sort(playlist, PLAYLIST_SORT_TITLE);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_BYARTIST:
         playlist_sort(playlist, PLAYLIST_SORT_ARTIST);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_BYPATH:
         playlist_sort(playlist, PLAYLIST_SORT_PATH);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_BYDATE:
         playlist_sort(playlist, PLAYLIST_SORT_DATE);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_BYFILENAME:
         playlist_sort(playlist, PLAYLIST_SORT_FILENAME);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_SEL_BYPLAYLIST:
         playlist_sort_selected(playlist, PLAYLIST_SORT_PLAYLIST);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_SEL_BYTRACK:
         playlist_sort_selected(playlist, PLAYLIST_SORT_TRACK);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_SEL_BYTITLE:
         playlist_sort_selected(playlist, PLAYLIST_SORT_TITLE);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_SEL_BYARTIST:
         playlist_sort_selected(playlist, PLAYLIST_SORT_ARTIST);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_SEL_BYFILENAME:
         playlist_sort_selected(playlist, PLAYLIST_SORT_FILENAME);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_SEL_BYPATH:
         playlist_sort_selected(playlist, PLAYLIST_SORT_PATH);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_SEL_BYDATE:
         playlist_sort_selected(playlist, PLAYLIST_SORT_DATE);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_REVERSE:
         playlist_reverse(playlist);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     case PLAYLISTWIN_SORT_RANDOMIZE:
         playlist_random(playlist);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     }
 }
@@ -2215,7 +2215,7 @@
         break;
     case PLAYLISTWIN_REFRESH:
         playlist_read_info_selection(playlist);
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         break;
     }
 }
--- a/audacious/ui_playlist.h	Sat Dec 16 02:52:03 2006 -0800
+++ b/audacious/ui_playlist.h	Sat Dec 16 04:49:16 2006 -0800
@@ -25,6 +25,7 @@
 
 #include "mainwin.h"
 #include "widgets/widgetcore.h"
+#include "playlist.h"
 
 #define PLAYLISTWIN_FRAME_TOP_HEIGHT    20
 #define PLAYLISTWIN_FRAME_BOTTOM_HEIGHT 38
@@ -48,7 +49,7 @@
 #define PLAYLISTWIN_DEFAULT_FONT        "Sans Bold 8"
 
 gboolean playlistwin_is_shaded(void);
-void playlistwin_update_list(void);
+void playlistwin_update_list(Playlist *playlist);
 gboolean playlistwin_item_visible(gint index);
 gint playlistwin_get_toprow(void);
 void playlistwin_set_toprow(gint top);
--- a/audacious/util.c	Sat Dec 16 02:52:03 2006 -0800
+++ b/audacious/util.c	Sat Dec 16 04:49:16 2006 -0800
@@ -790,13 +790,13 @@
         }       
 
         if (++ctr == 20) {
-            playlistwin_update_list();
+            playlistwin_update_list(playlist);
             ctr = 0;
             while (gtk_events_pending() ) gtk_main_iteration();
         }
     } 
 
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 
     if (GTK_IS_WIDGET(mainwin_jtf))
         gtk_widget_set_sensitive(mainwin_jtf, TRUE);
@@ -1119,7 +1119,7 @@
     while (files[ctr] != NULL) {
 	playlist_add(playlist, files[ctr++]);
     }
-    playlistwin_update_list();
+    playlistwin_update_list(playlist);
 
     if (GTK_IS_WIDGET(mainwin_jtf))
 	gtk_widget_set_sensitive(mainwin_jtf, TRUE);
--- a/audacious/widgets/playlist_list.c	Sat Dec 16 02:52:03 2006 -0800
+++ b/audacious/widgets/playlist_list.c	Sat Dec 16 04:49:16 2006 -0800
@@ -193,7 +193,7 @@
 
 			if (cfg.playlist_transparent)
 			{
-				playlistwin_update_list();
+				playlistwin_update_list(playlist_get_active());
 				draw_playlist_window(TRUE);
 			}
 		}
@@ -219,7 +219,7 @@
     if (pl->pl_auto_drag_down) {
         playlist_list_move_down(pl);
         pl->pl_first++;
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         return TRUE;
     }
     return FALSE;
@@ -233,7 +233,7 @@
     if (pl->pl_auto_drag_up) {
         playlist_list_move_up(pl);
         pl->pl_first--;
-        playlistwin_update_list();
+        playlistwin_update_list(playlist_get_active());
         return TRUE;
 
     }
@@ -369,7 +369,7 @@
         }
 
         pl->pl_dragging = TRUE;
-        playlistwin_update_list();
+        playlistwin_update_list(playlist);
     }
 }
 
@@ -439,7 +439,7 @@
                     playlist_list_move_down(pl);
 
             }
-            playlistwin_update_list();
+            playlistwin_update_list(playlist_get_active());
         }
         pl->pl_drag_pos = nr;
     }
--- a/audacious/widgets/skin.c	Sat Dec 16 02:52:03 2006 -0800
+++ b/audacious/widgets/skin.c	Sat Dec 16 04:49:16 2006 -0800
@@ -176,7 +176,7 @@
     draw_equalizer_window(TRUE);
 
     vis_set_window(mainwin_vis, mainwin->window);
-    playlistwin_update_list();
+    playlistwin_update_list(playlist_get_active());
 
     return TRUE;
 }