Hi folks,
I'm having some problems with a GSList and I don't know why. I can't find
any examples of g_slist_foreach now either!
Anyway, it goes like this...
g_slist_foreach(wl->signals, remove_signal, wl);
Where wl->signals is a GSList and wl is a structure containing a few other
things I need (clist mainly).
void remove_signal(gpointer data, gpointer windowl)
{
clist_holder *cl=(clist_holder *) data;
window_layout *wl=(window_layout *) windowl;
gint pos=g_slist_index(wl->signals, data);
printf("POS: %d of %d\n", pos, g_slist_length(wl->signals));
gtk_clist_remove(GTK_CLIST(wl->signal_lists), pos);
wl->signals=g_slist_remove(wl->signals, data);
}
Looks ok doesn't it? Well, it works the first time around, however the 2nd
time around the data pointer is always NULL. The printf outputs this:
POS: 0 of 4
POS: -1 of 3
POS: -1 of 3
<repeats>
I presume the g_slist_remove is re-allocating the GSList and I'm loosing it
somewhere. Does anyone know what I am doing wrong?
Ta,
Rich
_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list