aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-list.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-09-21 15:18:26 +0800
committerChris Lahey <clahey@src.gnome.org>2000-09-21 15:18:26 +0800
commit1771bc9932db7343e284d38507b7d639feafd750 (patch)
treeb6fc6ebb3ce3b9236489b559d147b2186228953d /e-util/e-list.c
parent9e6e29ee3ce7bb0f757d17fa02f44edc99ca592b (diff)
downloadgsoc2013-evolution-1771bc9932db7343e284d38507b7d639feafd750.tar
gsoc2013-evolution-1771bc9932db7343e284d38507b7d639feafd750.tar.gz
gsoc2013-evolution-1771bc9932db7343e284d38507b7d639feafd750.tar.bz2
gsoc2013-evolution-1771bc9932db7343e284d38507b7d639feafd750.tar.lz
gsoc2013-evolution-1771bc9932db7343e284d38507b7d639feafd750.tar.xz
gsoc2013-evolution-1771bc9932db7343e284d38507b7d639feafd750.tar.zst
gsoc2013-evolution-1771bc9932db7343e284d38507b7d639feafd750.zip
Made e_list a bit more reentrant. If a iterator gets its data pulled out
2000-09-18 Christopher James Lahey <clahey@helixcode.com> * e-list-iterator.c, e-list.c, e-list.h: Made e_list a bit more reentrant. If a iterator gets its data pulled out from under it while in a loop, it goes back one so that loops will be able to continue. svn path=/trunk/; revision=5533
Diffstat (limited to 'e-util/e-list.c')
-rw-r--r--e-util/e-list.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/e-util/e-list.c b/e-util/e-list.c
index 2a6f842888..6fd0e559d5 100644
--- a/e-util/e-list.c
+++ b/e-util/e-list.c
@@ -140,6 +140,24 @@ e_list_invalidate_iterators (EList *list, EIterator *skip)
}
}
+/* FIXME: This doesn't work properly if the iterator is the first
+ iterator in the list. Well, the iterator doesn't continue on after
+ the next time next is called, at least. */
+void
+e_list_remove_link (EList *list, GList *link)
+{
+ GList *iterators = list->iterators;
+ for (; iterators; iterators = iterators->next) {
+ if (((EListIterator *)iterators->data)->iterator == link) {
+ e_iterator_prev(iterators->data);
+ }
+ }
+ if (list->free)
+ list->free(link->data, list->closure);
+ list->list = g_list_remove_link(list->list, link);
+ g_list_free_1(link);
+}
+
void
e_list_remove_iterator (EList *list, EIterator *iterator)
{
@@ -156,3 +174,4 @@ e_list_destroy (GtkObject *object)
g_list_foreach(list->list, (GFunc) list->free, list->closure);
g_list_free(list->list);
}
+