mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
Make foreach() safe against removal of the _current_ element. While this
Thu May 3 06:38:28 2001 Owen Taylor <otaylor@redhat.com> * g[s]list.c (g_[s]list_foreach) docs/Changes-2.0.txt: Make foreach() safe against removal of the _current_ element. While this could break some code, the new behavior is consistent with the rest of GLib/GTK+ and probably is what people expect in most cases. (Suggested by Paul Kuykendall, #50071)
This commit is contained in:
@@ -589,8 +589,9 @@ g_slist_foreach (GSList *list,
|
||||
{
|
||||
while (list)
|
||||
{
|
||||
GSList *next = list->next;
|
||||
(*func) (list->data, user_data);
|
||||
list = list->next;
|
||||
list = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user