[glib/wip/gcleanup: 78/106] gdbus: Cleanup global static data



commit 7c425d3f3e2e4d45392f61c4abf09c4ff5956ba3
Author: Stef Walter <stefw gnome org>
Date:   Thu Nov 7 22:58:33 2013 +0100

    gdbus: Cleanup global static data
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711799

 gio/gdbusconnection.c |    5 ++++-
 gio/gdbuserror.c      |    3 +++
 2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index 8a0748d..1e16cf7 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -2645,7 +2645,10 @@ initable_init (GInitable     *initable,
 
   G_LOCK (message_bus_lock);
   if (alive_connections == NULL)
-    alive_connections = g_hash_table_new (g_direct_hash, g_direct_equal);
+    {
+      alive_connections = g_hash_table_new (g_direct_hash, g_direct_equal);
+      G_CLEANUP_IN_PHASE (alive_connections, g_hash_table_unref, G_CLEANUP_PHASE_LATE);
+    }
   g_hash_table_insert (alive_connections, connection, connection);
   G_UNLOCK (message_bus_lock);
 
diff --git a/gio/gdbuserror.c b/gio/gdbuserror.c
index 685d853..07be3f6 100644
--- a/gio/gdbuserror.c
+++ b/gio/gdbuserror.c
@@ -368,10 +368,13 @@ g_dbus_error_register_error (GQuark       error_domain,
       g_assert (dbus_error_name_to_re == NULL); /* check invariant */
       quark_code_pair_to_re = g_hash_table_new ((GHashFunc) quark_code_pair_hash_func,
                                                 (GEqualFunc) quark_code_pair_equal_func);
+      G_CLEANUP_IN_PHASE (quark_code_pair_to_re, g_hash_table_unref, G_CLEANUP_PHASE_LATE);
+
       dbus_error_name_to_re = g_hash_table_new_full (g_str_hash,
                                                      g_str_equal,
                                                      NULL,
                                                      (GDestroyNotify) registered_error_free);
+      G_CLEANUP_IN_PHASE (dbus_error_name_to_re, g_hash_table_unref, G_CLEANUP_PHASE_LATE);
     }
 
   if (g_hash_table_lookup (dbus_error_name_to_re, dbus_error_name) != NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]