aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-03-12 08:37:33 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-03-12 08:37:33 +0800
commited138c113d6171fa4513474e300d6b9fb45a39ec (patch)
tree8977e3584b481ad8569f9b852dcc3e17cf5259cf
parent2ac9216ba13699b6d6db45c4f438382920d06bae (diff)
downloadgsoc2013-evolution-ed138c113d6171fa4513474e300d6b9fb45a39ec.tar
gsoc2013-evolution-ed138c113d6171fa4513474e300d6b9fb45a39ec.tar.gz
gsoc2013-evolution-ed138c113d6171fa4513474e300d6b9fb45a39ec.tar.bz2
gsoc2013-evolution-ed138c113d6171fa4513474e300d6b9fb45a39ec.tar.lz
gsoc2013-evolution-ed138c113d6171fa4513474e300d6b9fb45a39ec.tar.xz
gsoc2013-evolution-ed138c113d6171fa4513474e300d6b9fb45a39ec.tar.zst
gsoc2013-evolution-ed138c113d6171fa4513474e300d6b9fb45a39ec.zip
removed, it was double-freeing the key. (save_object): Just save the
2003-03-12 Not Zed <NotZed@Ximian.com> * camel-object.c (remove_bag): removed, it was double-freeing the key. (save_object): Just save the object in an array. (camel_object_bag_destroy): first save the object bag's objects in a list, then remove them one at a time from the bag since we can't remove hash table entries while we're in a foreach (PITA glib shit). For #39486. (camel_object_bag_*): killed some warnings. svn path=/trunk/; revision=20258
-rw-r--r--camel/ChangeLog11
-rw-r--r--camel/camel-object.c21
2 files changed, 21 insertions, 11 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 04d55667e4..9f2ffe93d8 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,14 @@
+2003-03-12 Not Zed <NotZed@Ximian.com>
+
+ * camel-object.c (remove_bag): removed, it was double-freeing the
+ key.
+ (save_object): Just save the object in an array.
+ (camel_object_bag_destroy): first save the object bag's objects in
+ a list, then remove them one at a time from the bag since we can't
+ remove hash table entries while we're in a foreach (PITA glib
+ shit). For #39486.
+ (camel_object_bag_*): killed some warnings.
+
2003-03-09 Jeffrey Stedfast <fejj@ximian.com>
* camel-url-scanner.c (camel_url_addrspec_end): Doh! If inptr ==
diff --git a/camel/camel-object.c b/camel/camel-object.c
index b7f7cf5261..79e993b10e 100644
--- a/camel/camel-object.c
+++ b/camel/camel-object.c
@@ -1098,20 +1098,23 @@ CamelObjectBag *camel_object_bag_new(GHashFunc hash, GEqualFunc equal)
}
static void
-remove_bag(char *key, CamelObject *o, CamelObjectBag *bag)
+save_object(char *key, CamelObject *o, GPtrArray *objects)
{
- camel_object_bag_remove(bag, o);
- g_free(key);
+ g_ptr_array_add(objects, o);
}
void camel_object_bag_destroy(CamelObjectBag *bag)
{
- int val;
+ int i;
+ GPtrArray *objects = g_ptr_array_new();
- sem_getvalue(&bag->reserve_sem, &val);
- g_assert(val == 1);
+ sem_getvalue(&bag->reserve_sem, &i);
+ g_assert(i == 1);
- g_hash_table_foreach(bag->object_table, (GHFunc)remove_bag, bag);
+ g_hash_table_foreach(bag->object_table, (GHFunc)save_object, objects);
+ for (i=0;i<objects->len;i++)
+ camel_object_bag_remove(bag, objects->pdata[i]);
+ g_ptr_array_free(objects, TRUE);
g_hash_table_destroy(bag->object_table);
g_hash_table_destroy(bag->key_table);
#ifdef ENABLE_THREADS
@@ -1167,7 +1170,6 @@ void camel_object_bag_add(CamelObjectBag *bag, const char *key, void *vo)
void *camel_object_bag_get(CamelObjectBag *bag, const char *key)
{
CamelObject *o;
- int retry;
E_LOCK(type_lock);
@@ -1314,10 +1316,7 @@ static void camel_object_bag_remove_unlocked(CamelObjectBag *inbag, CamelObject
void camel_object_bag_remove(CamelObjectBag *inbag, void *vo)
{
CamelObject *o = vo;
- CamelHookPair *pair, *parent;
CamelHookList *hooks;
- char *oldkey;
- CamelObjectBag *bag;
if (o->hooks == NULL)
return;