From d8592f3b5725f9ee85235417269e72b75532d20c Mon Sep 17 00:00:00 2001 From: Window Maker Date: Mon, 25 May 2026 12:00:13 +0200 Subject: [PATCH] wayland: block SIGUSR2 early so library threads inherit the mask SIGUSR2 was being delivered to pango fontconfig threads instead of the signalfd because those threads were created before the signal mask was set in wl_event_loop_run. Block SIGUSR2 at the very start of real_main so all threads (including library-spawned ones) inherit the blocked mask and the signalfd is the sole recipient. --- src/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main.c b/src/main.c index 36143a2..cecc91d 100644 --- a/src/main.c +++ b/src/main.c @@ -32,6 +32,8 @@ #include #include #include +#include +#include /* Xlocale.h and locale.h are the same if X_LOCALE is undefind in wconfig.h, @@ -617,6 +619,16 @@ static int real_main(int argc, char **argv) { int i; + /* Block SIGUSR2 early so all threads (including library threads like + * pango's fontconfig thread) inherit the blocked mask. The signalfd + * in the Wayland event loop will be the sole recipient. */ + { + sigset_t ss; + sigemptyset(&ss); + sigaddset(&ss, SIGUSR2); + pthread_sigmask(SIG_BLOCK, &ss, NULL); + } + setlocale(LC_ALL, ""); wsetabort(wAbort);