mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-24 09:58:54 +02:00
make these safe against removal of the current element.
Fri May 11 18:25:23 2001 Tim Janik <timj@gtk.org> * gdataset.c: (g_dataset_foreach): (g_datalist_foreach): make these safe against removal of the current element.
This commit is contained in:
16
gdataset.c
16
gdataset.c
@@ -481,10 +481,13 @@ g_dataset_foreach (gconstpointer dataset_location,
|
||||
G_UNLOCK (g_dataset_global);
|
||||
if (dataset)
|
||||
{
|
||||
register GData *list;
|
||||
register GData *list, *next;
|
||||
|
||||
for (list = dataset->datalist; list; list = list->next)
|
||||
for (list = dataset->datalist; list; list = next)
|
||||
{
|
||||
next = list->next;
|
||||
func (list->id, list->data, user_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -498,13 +501,16 @@ g_datalist_foreach (GData **datalist,
|
||||
GDataForeachFunc func,
|
||||
gpointer user_data)
|
||||
{
|
||||
register GData *list;
|
||||
register GData *list, *next;
|
||||
|
||||
g_return_if_fail (datalist != NULL);
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
for (list = *datalist; list; list = list->next)
|
||||
func (list->id, list->data, user_data);
|
||||
for (list = *datalist; list; list = next)
|
||||
{
|
||||
next = list->next;
|
||||
func (list->id, list->data, user_data);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user