From 1c97dc139ed5e4d0758c444872d272a2d1aa38ab Mon Sep 17 00:00:00 2001 From: Valeri Ochinski Date: Wed, 18 Oct 2023 22:25:30 +0300 Subject: [PATCH] Close input monitor FD on server shutdown --- src/Server.vala | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Server.vala b/src/Server.vala index 1e6e35f..0722e5b 100644 --- a/src/Server.vala +++ b/src/Server.vala @@ -32,7 +32,9 @@ namespace Linuxmotehook { monitor = XWiimote.Monitor.create(true, true); } assert_nonnull(monitor); - monitor_source = new IOSource(new IOChannel.unix_new(monitor.get_fd()), IN); + var io_chan = new IOChannel.unix_new(monitor.get_fd()); + io_chan.set_close_on_unref(true); + monitor_source = new IOSource(io_chan, IN); // The following produces a warning, and it is intended IOFunc cb = add_available_wiimotes; monitor_source.set_callback(cb); @@ -42,9 +44,6 @@ namespace Linuxmotehook { } ~Server() { - if (monitor_source != null) - monitor_source.destroy(); - new LMApplication().release(); }