changeset 3563:cc888ce7b6fb trunk

link/unlink fixes
author William Pitcock <nenolod@atheme.org>
date Tue, 18 Sep 2007 13:54:22 -0500
parents 1caa559c5619
children 6e5104dcf645
files src/audacious/flow.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/flow.c	Tue Sep 18 13:51:23 2007 -0500
+++ b/src/audacious/flow.c	Tue Sep 18 13:54:22 2007 -0500
@@ -98,6 +98,9 @@
         flow->tail->next = element;
     
     flow->tail = element;        
+
+    if (!flow->head)
+        flow->head = element;
 }
 
 /* TBD: unlink all elements of func, or just the first --nenolod */
@@ -117,6 +120,12 @@
 
             iter->prev->next = iter->next;
 
+            if (flow->tail == iter)
+                flow->tail = iter->prev;
+
+            if (flow->head == iter)
+                flow->head = iter->next;
+
             g_slice_free(FlowElement, iter);
         }
 }