[glib] GDBus: Take a reference to the GDBusInterfaceInfo object



commit 87fa3a6e75132f68edfbd457632332c52c2048ba
Author: David Zeuthen <davidz redhat com>
Date:   Wed Jun 30 12:19:28 2010 -0400

    GDBus: Take a reference to the GDBusInterfaceInfo object
    
    Things will still work fine if the GDBusInterfaceInfo is allocated
    statically because if so the ref_count will be -1.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 gio/gdbusconnection.c  |    4 +++-
 gio/tests/gdbus-peer.c |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index 6ce4a36..2a3f2aa 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -3103,6 +3103,8 @@ typedef struct
 static void
 exported_interface_free (ExportedInterface *ei)
 {
+  g_dbus_interface_info_unref ((GDBusInterfaceInfo *) ei->interface_info);
+
   if (ei->user_data_free_func != NULL)
     /* TODO: push to thread-default mainloop */
     ei->user_data_free_func (ei->user_data);
@@ -4160,7 +4162,7 @@ g_dbus_connection_register_object (GDBusConnection            *connection,
   ei->user_data = user_data;
   ei->user_data_free_func = user_data_free_func;
   ei->vtable = vtable;
-  ei->interface_info = interface_info;
+  ei->interface_info = g_dbus_interface_info_ref ((GDBusInterfaceInfo *) interface_info);
   ei->interface_name = g_strdup (interface_info->name);
   ei->context = g_main_context_get_thread_default ();
   if (ei->context != NULL)
diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c
index 71bad62..4016b5e 100644
--- a/gio/tests/gdbus-peer.c
+++ b/gio/tests/gdbus-peer.c
@@ -822,7 +822,7 @@ dmp_on_new_connection (GDBusServer     *server,
                                      data,
                                      NULL,
                                      &error);
-  //g_dbus_node_info_unref (node);
+  g_dbus_node_info_unref (node);
 }
 
 static gpointer



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