diff options
author | Philip Van Hoof <philip@codeminded.be> | 2011-01-05 11:32:33 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2011-01-05 17:26:27 +0100 |
commit | 909889a6ff8fb5f1ce504333447c8b4718565da6 (patch) | |
tree | 95ccc5eba4b8304643e7b0b04a8a36a6f571d300 | |
parent | 3f64749f2727d79246e9981da50e1ac4a6c8dff5 (diff) | |
download | tracker-909889a6ff8fb5f1ce504333447c8b4718565da6.tar.gz |
Fixes deathlock
-rw-r--r-- | src/libtracker-common/tracker-dbus.c | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/src/libtracker-common/tracker-dbus.c b/src/libtracker-common/tracker-dbus.c index 581ded4d6..17c63fcbc 100644 --- a/src/libtracker-common/tracker-dbus.c +++ b/src/libtracker-common/tracker-dbus.c @@ -645,18 +645,33 @@ send_and_splice_async_callback (GObject *source, GAsyncResult *result, gpointer user_data) { + GError *error = NULL; + + g_output_stream_splice_finish (G_OUTPUT_STREAM (source), result, &error); + + if (error) { + g_critical ("Error while splicing: %s", + error ? error->message : "Error not specified"); + g_error_free (error); + } +} + +static void +tracker_dbus_send_and_splice_async_finish (GObject *source, + GAsyncResult *result, + gpointer user_data) +{ SendAndSpliceData *data = user_data; GError *error = NULL; - g_output_stream_splice_finish (data->output_stream, - result, - &error); + data->reply = g_dbus_connection_send_message_with_reply_finish (G_DBUS_CONNECTION (source), + result, &error); - if (G_LIKELY (!error)) { + if (!error) { /* dbus_pending_call_block (data->call); reply = dbus_pending_call_steal_reply (data->call); */ - if (G_UNLIKELY (g_dbus_message_get_message_type (data->reply) == G_DBUS_MESSAGE_TYPE_ERROR)) { + if (g_dbus_message_get_message_type (data->reply) == G_DBUS_MESSAGE_TYPE_ERROR) { /* If any error happened, we're not passing any received data, so we * need to free it */ @@ -699,34 +714,6 @@ send_and_splice_async_callback (GObject *source, } static void -tracker_dbus_send_and_splice_async_finish (GObject *source, - GAsyncResult *result, - gpointer user_data) -{ - SendAndSpliceData *data = user_data; - GError *error = NULL; - - data->reply = g_dbus_connection_send_message_with_reply_finish ((GDBusConnection *) source, - result, &error); - - if (error) { - g_critical ("FD passing unsupported or connection disconnected: %s", - error ? error->message : "No error provided"); - g_error_free (error); - return; - } - - g_output_stream_splice_async (data->output_stream, - data->buffered_input_stream, - G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | - G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, - 0, - data->cancellable, - send_and_splice_async_callback, - data); -} - -static void tracker_g_async_ready_callback (GObject *source_object, GAsyncResult *res, gpointer user_data) @@ -777,5 +764,14 @@ tracker_dbus_send_and_splice_async (GDBusConnection *connection tracker_dbus_send_and_splice_async_finish, user_data, NULL)); + g_output_stream_splice_async (data->output_stream, + data->buffered_input_stream, + G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | + G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, + 0, + data->cancellable, + send_and_splice_async_callback, + data); + return TRUE; } |