[next] telepathy-glib: TpBaseConnection: replace copy/ free with g_dbus_method_invocation_take_error()

Simon McVittie smcv at kemper.freedesktop.org
Wed May 7 02:18:23 PDT 2014


Module: telepathy-glib
Branch: next
Commit: 8f48cdd313c75d0c02f4a90ee1a99e02eab8efa5
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=8f48cdd313c75d0c02f4a90ee1a99e02eab8efa5

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Apr 11 14:52:57 2014 +0100

TpBaseConnection: replace copy/free with g_dbus_method_invocation_take_error()

The instance in ensure_handle_cb() is not obviously correct, but
in fact @error is not used after this point, so it doesn't need setting
to NULL.

Reviewed-by: Xavier Claessens <xavier.claessens at collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77189

---

 telepathy-glib/base-connection.c |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c
index 840491e..45631fe 100644
--- a/telepathy-glib/base-connection.c
+++ b/telepathy-glib/base-connection.c
@@ -266,8 +266,7 @@ static guint signals[N_SIGNALS] = {0};
     \
     if (!tp_base_connection_check_connected (c_, &e_)) \
       { \
-        g_dbus_method_invocation_return_gerror ((context), e_); \
-        g_error_free (e_); \
+        g_dbus_method_invocation_take_error ((context), e_); \
         return TRUE; \
       } \
   } G_STMT_END
@@ -1515,8 +1514,7 @@ tp_base_connection_connect (_TpGDBusConnection *skeleton,
                 TP_CONNECTION_STATUS_DISCONNECTED,
                 conn_status_reason_from_g_error (error));
             }
-          g_dbus_method_invocation_return_gerror (context, error);
-          g_error_free (error);
+          g_dbus_method_invocation_take_error (context, error);
           return TRUE;
         }
     }
@@ -2446,8 +2444,7 @@ conn_requests_requestotron_validate_handle (TpBaseConnection *self,
                */
               error->domain = TP_ERROR;
               error->code = TP_ERROR_INVALID_HANDLE;
-              g_dbus_method_invocation_return_gerror (context, error);
-              g_error_free (error);
+              g_dbus_method_invocation_take_error (context, error);
               return;
             }
 
@@ -2469,8 +2466,7 @@ conn_requests_requestotron_validate_handle (TpBaseConnection *self,
             {
               error->domain = TP_ERROR;
               error->code = TP_ERROR_INVALID_HANDLE;
-              g_dbus_method_invocation_return_gerror (context, error);
-              g_error_free (error);
+              g_dbus_method_invocation_take_error (context, error);
               return;
             }
 
@@ -3014,8 +3010,7 @@ ensure_handle_cb (GObject *source,
 
   if (handle == 0)
     {
-      g_dbus_method_invocation_return_gerror (data->context, error);
-      g_clear_error (&error);
+      g_dbus_method_invocation_take_error (data->context, error);
       goto out;
     }
 



More information about the telepathy-commits mailing list