From 9da85c7262325478e8730ae9f3e76bd0528a9a8c Mon Sep 17 00:00:00 2001 From: Lukasz Skalski Date: Tue, 5 May 2015 14:44:09 +0000 Subject: [PATCH] [kdbus] Do not set body message if signature field is empty --- gio/gdbusconnection.c | 28 +++++++++++++++++++--------- gio/gkdbus.c | 13 ++++++++----- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c index 5e1f0a1..a776ae9 100644 --- a/gio/gdbusconnection.c +++ b/gio/gdbusconnection.c @@ -629,7 +629,15 @@ g_dbus_connection_dispose (GObject *object) G_LOCK (message_bus_lock); CONNECTION_LOCK (connection); - if (connection->worker != NULL) + + if (connection->kdbus_worker != NULL) + { + g_kdbus_worker_stop (connection->kdbus_worker); + connection->kdbus_worker = NULL; + if (alive_connections != NULL) + g_warn_if_fail (g_hash_table_remove (alive_connections, connection)); + } + else if (connection->worker != NULL) { _g_dbus_worker_stop (connection->worker); connection->worker = NULL; @@ -1353,17 +1361,19 @@ g_dbus_connection_flush_sync (GDBusConnection *connection, if (!check_unclosed (connection, 0, error)) goto out; - if (connection->kdbus_worker) + if (connection->kdbus_worker != NULL) { + g_kdbus_worker_flush_sync (connection->kdbus_worker); ret = TRUE; - goto out; } - - g_assert (connection->worker != NULL); - - ret = _g_dbus_worker_flush_sync (connection->worker, - cancellable, - error); + else if (connection->worker != NULL) + { + ret = _g_dbus_worker_flush_sync (connection->worker, + cancellable, + error); + } + else + g_assert_not_reached(); out: return ret; diff --git a/gio/gkdbus.c b/gio/gkdbus.c index 0bb5766..dcaf2a1 100644 --- a/gio/gkdbus.c +++ b/gio/gkdbus.c @@ -2162,12 +2162,12 @@ g_kdbus_decode_dbus_msg (GKDBusWorker *worker, g_dbus_message_set_serial (message, serial); g_dbus_message_set_message_type (message, type); - //if (g_dbus_message_get_header (message, G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE) != NULL) - // { + if (g_dbus_message_get_header (message, G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE) != NULL) + { body = g_variant_get_variant (parts[1]); g_dbus_message_set_body (message, body); g_variant_unref (body); - // } + } g_variant_unref (parts[1]); //g_print ("Received:\n%s\n", g_dbus_message_print (message, 2)); @@ -2747,14 +2747,17 @@ g_kdbus_worker_send_message (GKDBusWorker *worker, return _g_kdbus_send (worker, message, error); } +/* TODO */ void -g_kdbus_worker_stop (GKDBusWorker *worker) +g_kdbus_worker_flush_sync (GKDBusWorker *worker) { + g_warning ("TODO: Implement sync flush"); } void -g_kdbus_worker_flush_sync (GKDBusWorker *worker) +g_kdbus_worker_stop (GKDBusWorker *worker) { + g_warning ("TODO: Implement worker stop"); } void -- 2.7.4