diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-01-19 15:47:44 +0100 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-01-19 16:25:19 +0100 |
commit | 139a0f63b6d832ddbff78fb507e1f21ff36680be (patch) | |
tree | bb80aeede606c8aacd300ea0c96d22965fb14976 /telepathy-glib/gnio-util.c | |
parent | 730121cd64471064cc1e76b3fd64a0a8cd612969 (diff) | |
download | telepathy-glib-139a0f63b6d832ddbff78fb507e1f21ff36680be.tar.gz |
TpStreamTubeChannel: Use async API to send/receive credentials
This fixes deadlock in unit test where sending and receiving are in
the same process (fd.o#44825).
Diffstat (limited to 'telepathy-glib/gnio-util.c')
-rw-r--r-- | telepathy-glib/gnio-util.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/telepathy-glib/gnio-util.c b/telepathy-glib/gnio-util.c index bd34e8621..cdf252735 100644 --- a/telepathy-glib/gnio-util.c +++ b/telepathy-glib/gnio-util.c @@ -662,6 +662,19 @@ typedef struct guchar byte; } ReceiveCredentialsWithByteData; +static ReceiveCredentialsWithByteData * +receive_credentials_with_byte_data_new (GCredentials *creds, + guchar byte) +{ + ReceiveCredentialsWithByteData *data; + + data = g_slice_new0 (ReceiveCredentialsWithByteData); + data->creds = g_object_ref (creds); + data->byte = byte; + + return data; +} + static void receive_credentials_with_byte_data_free (ReceiveCredentialsWithByteData *data) { @@ -674,7 +687,6 @@ receive_credentials_with_byte_async_thread (GSimpleAsyncResult *res, GObject *object, GCancellable *cancellable) { - ReceiveCredentialsWithByteData *data; guchar byte; GCredentials *creds; GError *error = NULL; @@ -687,12 +699,11 @@ receive_credentials_with_byte_async_thread (GSimpleAsyncResult *res, return; } - data = g_slice_new0 (ReceiveCredentialsWithByteData); - data->creds = creds; - data->byte = byte; - - g_simple_async_result_set_op_res_gpointer (res, data, + g_simple_async_result_set_op_res_gpointer (res, + receive_credentials_with_byte_data_new (creds, byte), (GDestroyNotify) receive_credentials_with_byte_data_free); + + g_object_unref (creds); } /** |