aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/gui/comp-editor-factory.c30
2 files changed, 17 insertions, 20 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 44954fc8e0..df79689212 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,10 @@
+2007-10-02 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #469657
+
+ * gui/comp-editor-factory.c:
+ Use destroy functions in GHashTables to simplify memory management.
+
2007-10-01 Milan Crha <mcrha@redhat.com>
** Fix for bug #428402
diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c
index 95216604c8..dd508987d4 100644
--- a/calendar/gui/comp-editor-factory.c
+++ b/calendar/gui/comp-editor-factory.c
@@ -129,18 +129,6 @@ comp_editor_factory_class_init (CompEditorFactoryClass *class)
object_class->finalize = comp_editor_factory_finalize;
}
-/* Object initialization function for the component editor factory */
-static void
-comp_editor_factory_init (CompEditorFactory *factory)
-{
- CompEditorFactoryPrivate *priv;
-
- priv = g_new (CompEditorFactoryPrivate, 1);
- factory->priv = priv;
-
- priv->uri_client_hash = g_hash_table_new (g_str_hash, g_str_equal);
-}
-
/* Frees a Request structure */
static void
free_request (Request *r)
@@ -175,14 +163,19 @@ free_client (OpenClient *oc)
g_free (oc);
}
-/* Used from g_hash_table_foreach(); frees a client structure */
+/* Object initialization function for the component editor factory */
static void
-free_client_cb (gpointer key, gpointer value, gpointer data)
+comp_editor_factory_init (CompEditorFactory *factory)
{
- OpenClient *oc;
+ CompEditorFactoryPrivate *priv;
+
+ priv = g_new (CompEditorFactoryPrivate, 1);
+ factory->priv = priv;
- oc = value;
- free_client (oc);
+ priv->uri_client_hash = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) NULL,
+ (GDestroyNotify) free_client);
}
/* Destroy handler for the component editor factory */
@@ -198,7 +191,6 @@ comp_editor_factory_finalize (GObject *object)
factory = COMP_EDITOR_FACTORY (object);
priv = factory->priv;
- g_hash_table_foreach (priv->uri_client_hash, free_client_cb, NULL);
g_hash_table_destroy (priv->uri_client_hash);
priv->uri_client_hash = NULL;
@@ -232,7 +224,6 @@ editor_destroy_cb (GtkObject *object, gpointer data)
return;
g_hash_table_remove (priv->uri_client_hash, oc->uri);
- free_client (oc);
}
/* Starts editing an existing component on a client that is already open */
@@ -442,7 +433,6 @@ cal_opened_cb (ECal *client, ECalendarStatus status, gpointer data)
gtk_widget_destroy (dialog);
g_hash_table_remove (priv->uri_client_hash, oc->uri);
- free_client (oc);
}
/* Creates a new OpenClient structure and queues the component editing/creation