From 880ff6da35728b047915ad804f5c49aaf282883d Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 21 Jan 2019 00:56:14 +0900 Subject: Fixed bug in TDE hw dbus daemon that would cause the daemon to go into infinite loop if the connection was lost unexpectedly. Also fixed release of connection on exit. Signed-off-by: Michele Calgaro --- tdecore/tdehw/hwlibdaemons/dbus/tde_dbus_hardwarecontrol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tdecore/tdehw/hwlibdaemons/dbus/tde_dbus_hardwarecontrol.c b/tdecore/tdehw/hwlibdaemons/dbus/tde_dbus_hardwarecontrol.c index f17e9dea6..77200334e 100644 --- a/tdecore/tdehw/hwlibdaemons/dbus/tde_dbus_hardwarecontrol.c +++ b/tdecore/tdehw/hwlibdaemons/dbus/tde_dbus_hardwarecontrol.c @@ -729,9 +729,9 @@ void listen() { } // loop, testing for new messages - while (true) { + // block for up to 1 second, exit in case the connection was lost + while (dbus_connection_read_write(conn, 1000)) { // non blocking read of the next available message - dbus_connection_read_write(conn, 1000); // block for up to 1 second msg = dbus_connection_pop_message(conn); // loop again if we haven't got a message @@ -847,7 +847,7 @@ void listen() { } // close the connection - dbus_connection_close(conn); + dbus_connection_unref(conn); } int main(int argc, char** argv) { -- cgit v1.2.3