[dconf/wip/reorg: 495/523] GDBus backends: sink parameters, even on failure



commit 67144c4fdc8362e6c1b2550301cc235b596d6e44
Author: Ryan Lortie <desrt desrt ca>
Date:   Fri Jul 6 14:08:44 2012 -0400

    GDBus backends: sink parameters, even on failure
    
    The GDBus backends were not sinking the parameters for method calls on
    failure to acquire the bus.

 gdbus/dconf-gdbus-filter.c |   11 +++++++++--
 gdbus/dconf-gdbus-thread.c |    4 +++-
 2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/gdbus/dconf-gdbus-filter.c b/gdbus/dconf-gdbus-filter.c
index 09ff43d..8e8f42b 100644
--- a/gdbus/dconf-gdbus-filter.c
+++ b/gdbus/dconf-gdbus-filter.c
@@ -217,7 +217,10 @@ dconf_engine_dbus_call_async_func (GBusType                bus_type,
   state = dconf_gdbus_get_connection_state (bus_type, error);
 
   if (state == NULL)
-    return FALSE;
+    {
+      g_variant_unref (g_variant_ref_sink (parameters));
+      return FALSE;
+    }
 
   message = g_dbus_message_new_method_call (bus_name, object_path, interface_name, method_name);
   g_dbus_message_set_body (message, parameters);
@@ -286,7 +289,11 @@ dconf_engine_dbus_call_sync_func (GBusType             bus_type,
   state = dconf_gdbus_get_connection_state (bus_type, error);
 
   if (state == NULL)
-    return NULL;
+    {
+      g_variant_unref (g_variant_ref_sink (parameters));
+
+      return NULL;
+    }
 
   return g_dbus_connection_call_sync (connection_state_get_connection (state),
                                       bus_name, object_path, interface_name, method_name, parameters, reply_type,
diff --git a/gdbus/dconf-gdbus-thread.c b/gdbus/dconf-gdbus-thread.c
index 14183d0..3c868b5 100644
--- a/gdbus/dconf-gdbus-thread.c
+++ b/gdbus/dconf-gdbus-thread.c
@@ -273,7 +273,7 @@ dconf_engine_dbus_call_async_func (GBusType                bus_type,
   call->object_path = object_path;
   call->interface_name = interface_name;
   call->method_name = method_name;
-  call->parameters = g_variant_ref (parameters);
+  call->parameters = g_variant_ref_sink (parameters);
   call->handle = handle;
 
   g_main_context_invoke (dconf_gdbus_get_worker_context (), dconf_gdbus_method_call, call);
@@ -336,6 +336,8 @@ dconf_engine_dbus_call_sync_func (GBusType             bus_type,
 
   if (connection == NULL)
     {
+      g_variant_unref (g_variant_ref_sink (parameters));
+
       if (error)
         *error = g_error_copy (inner_error);
 



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