WPrefs: drop SIGUSR2, rely on inotify for defaults reload

SIGUSR2 is fundamentally unsafe in a multi-threaded compositor: library
threads (pango fontconfig) created after pthread_sigmask receive the
signal and crash. The Wayland event loop already has inotify watching
the defaults directory, so file changes are detected automatically
without any explicit signaling.

The early pthread_sigmask(SIG_BLOCK, SIGUSR2) is retained as a safety
measure to prevent stray SIGUSR2 from terminating the compositor.
This commit is contained in:
Window Maker 2026-05-25 12:02:26 +02:00
parent d8592f3b57
commit b94bc2ce95
2 changed files with 3 additions and 17 deletions

View File

@ -17,8 +17,6 @@
#include <string.h>
#include <strings.h>
#include <signal.h>
#include <unistd.h>
#include <xkbcommon/xkbcommon.h>
/* ------------------------------------------------------------------ */
@ -377,14 +375,9 @@ static void wl_keysym_convert_case(void *ectx, WMNativeKeysym sym,
static void wl_send_wm_command(void *ectx, const char *cmd)
{
(void)ectx;
if (cmd && strcmp(cmd, "Reconfigure") == 0) {
const char *pidstr = getenv("WMAKER_PID");
if (pidstr) {
pid_t pid = (pid_t)atoi(pidstr);
if (pid > 0)
kill(pid, SIGUSR2);
}
}
(void)cmd;
/* Wayland backend relies on inotify to detect defaults file changes.
* No explicit signal needed — wmaker's event loop polls inotify. */
}
static void wl_set_window_hints(void *ectx, WNativeWindow w,

View File

@ -3480,12 +3480,6 @@ wl_signalfd_handler(int fd, uint32_t mask, void *data)
if (n != (ssize_t)sizeof(info))
return 0;
if (info.ssi_signo == SIGUSR2) {
wwarning("wl_backend: signalfd received SIGUSR2 - rereading defaults");
wDefaultsCheckDomains(NULL);
return 0;
}
wwarning("wl_backend: signalfd received signal %u - terminating event loop",
(unsigned)info.ssi_signo);
@ -3577,7 +3571,6 @@ wl_event_loop_run(void)
sigaddset(&ss, SIGTERM);
sigaddset(&ss, SIGINT);
sigaddset(&ss, SIGHUP);
sigaddset(&ss, SIGUSR2);
wl_state.sigfd = signalfd(-1, &ss, SFD_NONBLOCK | SFD_CLOEXEC);
if (wl_state.sigfd >= 0) {