summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2019-01-21 00:56:14 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2019-02-06 23:37:13 +0900
commit880ff6da35728b047915ad804f5c49aaf282883d (patch)
treec8038d80c4eb133c547a632cbdf9c95a1527e0e9
parent841ae5477c24b9740296e4e3cfde211800d92528 (diff)
downloadtdelibs-880ff6da35728b047915ad804f5c49aaf282883d.tar.gz
tdelibs-880ff6da35728b047915ad804f5c49aaf282883d.zip
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 <michele.calgaro@yahoo.it>
-rw-r--r--tdecore/tdehw/hwlibdaemons/dbus/tde_dbus_hardwarecontrol.c6
1 files 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 f17e9dea..77200334 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) {