The keyboard-state module crashes with SIGSEGV in libinput_device_ref
when a new input device appears in /dev/input/.
Three bugs fixed:
1. Missing NULL check: tryAddDevice() calls libinput_path_add_device()
which returns NULL on failure, then immediately passes the result to
libinput_device_ref() without checking. On laptops, virtual input
devices (power buttons, lid switch, etc.) appear and disappear in
/dev/input/ triggering the hotplug handler; if libinput can't open
one of these, the NULL return causes the segfault.
2. Missing cleanup on device removal: The IN_DELETE handler erased
devices from the map without calling libinput_path_remove_device(),
leaving dangling pointers in the libinput context.
3. Thread safety: libinput_devices_ was accessed from 3 threads
(main/GTK, libinput_thread_, hotplug_thread_) without any mutex.
Fixes#4851
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move GTK operations from IPC thread to GTK main thread in Window module
- Move GTK operations from IPC thread to GTK main thread in WindowCount module
- Move GTK style class operations from IPC thread to GTK main thread in Submap module
- Language and Workspaces modules already safe (only update internal state)
Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
The monitor signal handlers (signal_monitor_added, signal_monitor_removed)
were never disconnected during SIGUSR2 reload. Each reload accumulated
additional handlers, causing multiple layer surfaces to be created when
monitors were hotplugged.
This fix:
- Stores signal connections as class members
- Disconnects them before reconnecting in bindInterfaces()
- Clears stale outputs_ on reload
Before this, vacant tags would show with `hide-vacant` set on initial
startup, because we receive initial tag events from River before we show
the bar. In that case, we won't call `set_visible(false)` on the
respective buttons because they're not shown yet. This registers the
output status listener after we show the bar so we won't miss any
events.
In rare circumstances, we may fork(), e.g., as part of a custom module,
and the child process may fail to exec() and exit. In those cases, the
IPC destructor will be called in the child process.
Prior to this commit, this call would then result in the shared socket
being closed. Prevent this by only closing the socket from the original
process.
Fixes#3975 and #4152.
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>