Re: GSList corruption?
- From: Havoc Pennington <hp redhat com>
- To: rhfreeman <rhfreeman micron com>
- Cc: "'gtk-list gnome org'" <gtk-list gnome org>
- Subject: Re: GSList corruption?
- Date: 21 May 2001 10:50:09 -0400
rhfreeman <rhfreeman micron com> writes:
>
> Anyway, it goes like this...
>
> g_slist_foreach(wl->signals, remove_signal, wl);
You can't currently remove list nodes inside a foreach. In GLib 2.0,
this works though.
The function changed as follows:
1.2:
void
g_slist_foreach (GSList *list,
GFunc func,
gpointer user_data)
{
while (list)
{
(*func) (list->data, user_data);
list = list->next;
}
}
2.0:
void
g_slist_foreach (GSList *list,
GFunc func,
gpointer user_data)
{
while (list)
{
GSList *next = list->next;
(*func) (list->data, user_data);
list = next;
}
}
So you see the issue in 1.2 with removing the node you're currently on.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]