Mercurial > audlegacy
changeset 1352:8b249765fdd1 trunk
[svn] - GList cannot handle circular queues, so I integrated one into CategoryQueueEntry. No fuss, no muss.
author | nenolod |
---|---|
date | Wed, 28 Jun 2006 15:32:15 -0700 |
parents | fbb38017d144 |
children | 35ef03569852 |
files | ChangeLog audacious/prefswin.c |
diffstat | 2 files changed, 23 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jun 28 13:50:30 2006 -0700 +++ b/ChangeLog Wed Jun 28 15:32:15 2006 -0700 @@ -1,3 +1,12 @@ +2006-06-28 20:50:30 +0000 William Pitcock <nenolod@nenolod.net> + revision [1614] + - why are we requiring a lock in functions that are in the nolock namespace? + + + Changes: Modified: + +0 -3 trunk/audacious/playlist.c + + 2006-06-28 20:16:32 +0000 William Pitcock <nenolod@nenolod.net> revision [1612] - extra sanity checking keeps the double-free away
--- a/audacious/prefswin.c Wed Jun 28 13:50:30 2006 -0700 +++ b/audacious/prefswin.c Wed Jun 28 15:32:15 2006 -0700 @@ -119,12 +119,13 @@ }; typedef struct { + void *next; GtkWidget *container; char *pg_name; char *img_url; } CategoryQueueEntry; -static GList *category_queue = NULL; +CategoryQueueEntry *category_queue = NULL; static const guint n_title_field_tags = G_N_ELEMENTS(title_field_tags); @@ -1777,7 +1778,7 @@ GtkTreeSelection *selection; GtkTreeIter iter; GdkPixbuf *img; - GList *qlist; + CategoryQueueEntry *qlist; gint i; column = gtk_tree_view_column_new(); @@ -1816,9 +1817,10 @@ /* mark the treeview widget as available to third party plugins */ category_treeview = GTK_WIDGET(treeview); - for (qlist = category_queue; qlist != NULL && qlist->data; qlist = g_list_next(qlist)) + /* prefswin_page_queue_destroy already pops the queue forward for us. */ + for (qlist = category_queue; qlist != NULL; qlist = category_queue) { - CategoryQueueEntry *ent = (CategoryQueueEntry *) qlist->data; + CategoryQueueEntry *ent = (CategoryQueueEntry *) qlist; prefswin_page_new(ent->container, ent->pg_name, ent->img_url); prefswin_page_queue_destroy(ent); @@ -2301,18 +2303,22 @@ static void prefswin_page_queue_new(GtkWidget *container, gchar *name, gchar *imgurl) { - CategoryQueueEntry *ent = g_new0(CategoryQueueEntry, 1); + CategoryQueueEntry *ent = g_malloc0(sizeof(CategoryQueueEntry)); ent->container = container; ent->pg_name = name; ent->img_url = imgurl; - category_queue = g_list_append(category_queue, ent); + + if (category_queue) + ent->next = category_queue; + + category_queue = ent; } static void prefswin_page_queue_destroy(CategoryQueueEntry *ent) { - category_queue = g_list_remove(category_queue, ent); + category_queue = ent->next; g_free(ent); } @@ -2336,7 +2342,7 @@ GtkTreeView *treeview = GTK_TREE_VIEW(category_treeview); gint id; - if (treeview == NULL || container == NULL || category_notebook == NULL) + if (treeview == NULL || category_notebook == NULL) { prefswin_page_queue_new(container, name, imgurl); return -1;