[glib/wip/gcleanup: 42/71] gdbus: Cleanup global static data



commit aac60b00b2dba9031ff27081591a8ee694a3a317
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..5007f98 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 (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..cc4e842 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 (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 (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]