changeset 4646:c18e18ecc36b

Proper updating of playlist->tail was missing from some functions. Patch adapted from one by lajnold@hotmail.com. Closes bugzilla #22 and #27.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 15 Jun 2008 00:00:55 +0300
parents e36c207de2c1
children 8ce9256b0b1d
files src/audacious/playlist.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Fri Jun 13 17:57:04 2008 +0300
+++ b/src/audacious/playlist.c	Sun Jun 15 00:00:55 2008 +0300
@@ -704,8 +704,10 @@
                 } else
                     add_flag = FALSE;
             }
-        } else
+        } else {
             playlist->entries = g_list_insert(playlist->entries, entry, pos++);
+            playlist->tail = g_list_last(playlist->entries);
+        }
 
         if (tuple != NULL) {
             const gchar *formatter = tuple_get_string(tuple, FIELD_FORMATTER, NULL);
@@ -2175,6 +2177,7 @@
     playlist->entries =
         g_list_sort(playlist->entries,
                     (GCompareFunc) playlist_compare_func_table[type]);
+    playlist->tail = g_list_last(playlist->entries);
     PLAYLIST_INCR_SERIAL(playlist);
     PLAYLIST_UNLOCK(playlist);
 }
@@ -2235,6 +2238,7 @@
     playlist->entries = playlist_sort_selected_generic(playlist->entries, (GCompareFunc)
                                                        playlist_compare_func_table
                                                        [type]);
+    playlist->tail = g_list_last(playlist->entries);
     PLAYLIST_INCR_SERIAL(playlist);
     PLAYLIST_UNLOCK(playlist);
 }
@@ -2244,6 +2248,7 @@
 {
     PLAYLIST_LOCK(playlist);
     playlist->entries = g_list_reverse(playlist->entries);
+    playlist->tail = g_list_last(playlist->entries);
     PLAYLIST_INCR_SERIAL(playlist);
     PLAYLIST_UNLOCK(playlist);
 }
@@ -2297,6 +2302,7 @@
 {
     PLAYLIST_LOCK(playlist);
     playlist->entries = playlist_shuffle_list(playlist, playlist->entries);
+    playlist->tail = g_list_last(playlist->entries);
     PLAYLIST_INCR_SERIAL(playlist);
     PLAYLIST_UNLOCK(playlist);
 }