Skip to content

Commit

Permalink
Close input monitor FD on server shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
v1993 committed Oct 18, 2023
1 parent 49facff commit 1c97dc1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Server.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -42,9 +44,6 @@ namespace Linuxmotehook {
}

~Server() {
if (monitor_source != null)
monitor_source.destroy();

new LMApplication().release();
}

Expand Down

0 comments on commit 1c97dc1

Please sign in to comment.