[evolution-data-server/treitter-client-gdbus] Don't double-free the list of connections (after it's already an invalid pointer)
- From: Travis Reitter <treitter src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-data-server/treitter-client-gdbus] Don't double-free the list of connections (after it's already an invalid pointer)
- Date: Tue, 15 Dec 2009 19:45:59 +0000 (UTC)
commit 95a50ca2fd4ba189576e780d79939a79db96efe7
Author: Travis Reitter <treitter gmail com>
Date: Fri Dec 11 08:38:14 2009 -0800
Don't double-free the list of connections (after it's already an invalid pointer)
calendar/libedata-cal/e-data-cal-factory.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/calendar/libedata-cal/e-data-cal-factory.c b/calendar/libedata-cal/e-data-cal-factory.c
index 0f078cc..e656c6f 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -451,11 +451,13 @@ name_owner_changed (DBusGProxy *proxy,
if (strcmp (new_owner, "") == 0 && strcmp (name, prev_owner) == 0) {
gchar *key;
GList *list = NULL;
- if (g_hash_table_lookup_extended (factory->priv->connections, prev_owner, (gpointer)&key, (gpointer)&list)) {
- g_list_foreach (list, (GFunc)g_object_unref, NULL);
- g_list_free (list);
- g_hash_table_remove (factory->priv->connections, prev_owner);
- }
+ while (g_hash_table_lookup_extended (factory->priv->connections, prev_owner, (gpointer)&key, (gpointer)&list)) {
+ /* this should trigger the book's weak ref notify
+ * function, which will remove it from the list before
+ * it's freed, and will remove the connection from
+ * priv->connections once they're all gone */
+ g_object_unref (list->data);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]