diff options
author | Dan Winship <danw@src.gnome.org> | 2003-05-20 20:00:38 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2003-05-20 20:00:38 +0800 |
commit | 29c2c9098e10451d6339748dbfc58c5b5fb68d28 (patch) | |
tree | 893ac2b59cd8be0a19c5be26816308a00d3e3176 /calendar/pcs/cal-backend.c | |
parent | 2913c7ef314431dbb93135e80d9fc228fe83f9de (diff) | |
download | gsoc2013-evolution-29c2c9098e10451d6339748dbfc58c5b5fb68d28.tar.gz gsoc2013-evolution-29c2c9098e10451d6339748dbfc58c5b5fb68d28.tar.zst gsoc2013-evolution-29c2c9098e10451d6339748dbfc58c5b5fb68d28.zip |
Don't double-free newly-added categories that the gui hasn't been told
* pcs/cal-backend.c (cal_backend_finalize): Don't double-free
newly-added categories that the gui hasn't been told about yet.
#43321
svn path=/trunk/; revision=21275
Diffstat (limited to 'calendar/pcs/cal-backend.c')
-rw-r--r-- | calendar/pcs/cal-backend.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index bf974ddc70..f493302136 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -222,6 +222,16 @@ free_category_cb (gpointer key, gpointer value, gpointer data) g_free (c); } +static gboolean +prune_changed_categories (gpointer key, gpointer value, gpointer data) +{ + CalBackendCategory *c = value; + + if (!c->refcount) + free_category_cb (key, value, data); + return TRUE; +} + void cal_backend_finalize (GObject *object) { @@ -232,12 +242,12 @@ cal_backend_finalize (GObject *object) g_assert (priv->clients == NULL); + g_hash_table_foreach_remove (priv->changed_categories, prune_changed_categories, NULL); + g_hash_table_destroy (priv->changed_categories); + g_hash_table_foreach (priv->categories, free_category_cb, NULL); g_hash_table_destroy (priv->categories); - g_hash_table_foreach (priv->changed_categories, free_category_cb, NULL); - g_hash_table_destroy (priv->changed_categories); - if (priv->category_idle_id) g_source_remove (priv->category_idle_id); @@ -1153,18 +1163,6 @@ notify_categories_changed (CalBackend *backend) } static gboolean -prune_changed_categories (gpointer key, gpointer value, gpointer data) -{ - CalBackendCategory *category = value; - - if (!category->refcount) { - g_free (category->name); - g_free (category); - } - return TRUE; -} - -static gboolean idle_notify_categories_changed (gpointer data) { CalBackend *backend = CAL_BACKEND (data); |