diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-04-05 13:32:24 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-04-05 13:32:24 +0000 |
commit | d6786e501ef0d719263192bb707bc092d2a26e88 (patch) | |
tree | 0cf168465ca76869bd08b976af83c6f7f458330e | |
parent | 9854bcfa4e2f648317f2257ec365685261166aff (diff) |
Use plural TpHandleRepoIface methods to simplify GabbleConnection. Also fix handle leak when an error occurs during room verification.
-rw-r--r-- | src/gabble-connection.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gabble-connection.c b/src/gabble-connection.c index c616d28a0..b60f76290 100644 --- a/src/gabble-connection.c +++ b/src/gabble-connection.c @@ -2486,8 +2486,12 @@ struct _RoomVerifyContext { static void room_verify_batch_free (RoomVerifyBatch *batch) { + TpBaseConnection *base = (TpBaseConnection *)(batch->conn); + TpHandleRepoIface *room_handles = tp_base_connection_get_handles (base, + TP_HANDLE_TYPE_ROOM); guint i; + tp_handles_unref (room_handles, batch->handles); g_array_free (batch->handles, TRUE); for (i = 0; i < batch->count; i++) { @@ -2579,6 +2583,8 @@ room_verify_batch_try_return (RoomVerifyBatch *batch) guint i; TpHandleRepoIface *room_handles = tp_base_connection_get_handles ( (TpBaseConnection *)batch->conn, TP_HANDLE_TYPE_ROOM); + gchar *sender; + GError *error = NULL; for (i = 0; i < batch->count; i++) { @@ -2591,6 +2597,25 @@ room_verify_batch_try_return (RoomVerifyBatch *batch) hold_unref_and_return_handles (batch->invocation, room_handles, batch->handles); + + sender = dbus_g_method_get_sender (batch->invocation); + if (!tp_handles_client_hold (room_handles, sender, batch->handles, &error)) + { + g_assert (error != NULL); + } + g_free (sender); + + if (error == NULL) + { + tp_svc_connection_return_from_request_handles (batch->invocation, + batch->handles); + } + else + { + dbus_g_method_return_error (batch->invocation, error); + g_error_free (error); + } + room_verify_batch_free (batch); return TRUE; } |