From d812463649e486daee654e1ce3b517a676333396 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 21 Feb 2025 23:25:54 +1000 Subject: [PATCH] Qt: Ensure SIGCHLD is ignored properly --- src/duckstation-qt/qthost.cpp | 5 +++-- src/duckstation-regtest/regtest_host.cpp | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index 704765ae2..4c9c45a9d 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -2634,11 +2634,12 @@ void QtHost::HookSignals() std::signal(SIGINT, SignalHandler); std::signal(SIGTERM, SignalHandler); -#ifdef __linux__ +#ifndef _WIN32 // Ignore SIGCHLD by default on Linux, since we kick off aplay asynchronously. struct sigaction sa_chld = {}; sigemptyset(&sa_chld.sa_mask); - sa_chld.sa_flags = SA_SIGINFO | SA_RESTART | SA_NOCLDSTOP | SA_NOCLDWAIT; + sa_chld.sa_handler = SIG_IGN; + sa_chld.sa_flags = SA_RESTART | SA_NOCLDSTOP | SA_NOCLDWAIT; sigaction(SIGCHLD, &sa_chld, nullptr); #endif } diff --git a/src/duckstation-regtest/regtest_host.cpp b/src/duckstation-regtest/regtest_host.cpp index d718a8cd6..97b0ac0e8 100644 --- a/src/duckstation-regtest/regtest_host.cpp +++ b/src/duckstation-regtest/regtest_host.cpp @@ -616,6 +616,15 @@ void RegTestHost::HookSignals() { std::signal(SIGINT, SignalHandler); std::signal(SIGTERM, SignalHandler); + +#ifndef _WIN32 + // Ignore SIGCHLD by default on Linux, since we kick off aplay asynchronously. + struct sigaction sa_chld = {}; + sigemptyset(&sa_chld.sa_mask); + sa_chld.sa_handler = SIG_IGN; + sa_chld.sa_flags = SA_RESTART | SA_NOCLDSTOP | SA_NOCLDWAIT; + sigaction(SIGCHLD, &sa_chld, nullptr); +#endif } void RegTestHost::GPUThreadEntryPoint()