From 8e8f55b18a90417e9485b1025c211b2e029ac61e Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 10 Jan 2022 22:30:37 +0200 Subject: [PATCH] Drop Process helper Direct session is long time gone and SIGUSR1 and SIGUSR2 are not used anywhere so drop the Process helper. --- src/inputmethod.cpp | 2 +- src/main_wayland.cpp | 10 ++-------- src/rules.cpp | 2 +- src/useractions.cpp | 2 +- src/utils.cpp | 17 ----------------- src/utils.h | 17 ----------------- src/xwl/xwayland.cpp | 2 +- 7 files changed, 6 insertions(+), 46 deletions(-) diff --git a/src/inputmethod.cpp b/src/inputmethod.cpp index 4ae5ee95f5..2a2aa22591 100644 --- a/src/inputmethod.cpp +++ b/src/inputmethod.cpp @@ -690,7 +690,7 @@ void InputMethod::startInputMethod() environment.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("wayland")); environment.remove("WAYLAND_DISPLAY"); - m_inputMethodProcess = new Process(this); + m_inputMethodProcess = new QProcess(this); m_inputMethodProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel); m_inputMethodProcess->setProcessEnvironment(environment); m_inputMethodProcess->setProgram(program); diff --git a/src/main_wayland.cpp b/src/main_wayland.cpp index 84745a89fd..30e04c4b05 100644 --- a/src/main_wayland.cpp +++ b/src/main_wayland.cpp @@ -231,7 +231,7 @@ void ApplicationWayland::startSession() QStringList arguments = KShell::splitArgs(m_sessionArgument); if (!arguments.isEmpty()) { QString program = arguments.takeFirst(); - QProcess *p = new Process(this); + QProcess *p = new QProcess(this); p->setProcessChannelMode(QProcess::ForwardedErrorChannel); p->setProcessEnvironment(processStartupEnvironment()); connect(p, qOverload(&QProcess::finished), this, [p] (int code, QProcess::ExitStatus status) { @@ -268,7 +268,7 @@ void ApplicationWayland::startSession() QString program = arguments.takeFirst(); // note: this will kill the started process when we exit // this is going to happen anyway as we are the wayland and X server the app connects to - QProcess *p = new Process(this); + QProcess *p = new QProcess(this); p->setProcessChannelMode(QProcess::ForwardedErrorChannel); p->setProcessEnvironment(processStartupEnvironment()); p->setProgram(program); @@ -377,12 +377,6 @@ int main(int argc, char * argv[]) signal(SIGABRT, KWin::unsetDumpable); signal(SIGSEGV, KWin::unsetDumpable); signal(SIGPIPE, SIG_IGN); - // ensure that no thread takes SIGUSR - sigset_t userSignals; - sigemptyset(&userSignals); - sigaddset(&userSignals, SIGUSR1); - sigaddset(&userSignals, SIGUSR2); - pthread_sigmask(SIG_BLOCK, &userSignals, nullptr); QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); diff --git a/src/rules.cpp b/src/rules.cpp index 873d405a05..38bcd04ba2 100644 --- a/src/rules.cpp +++ b/src/rules.cpp @@ -1003,7 +1003,7 @@ void RuleBook::edit(AbstractClient* c, bool whole_app) args << QStringLiteral("--uuid") << c->internalId().toString(); if (whole_app) args << QStringLiteral("--whole-app"); - QProcess *p = new Process(this); + QProcess *p = new QProcess(this); p->setArguments(args); p->setProcessEnvironment(kwinApp()->processStartupEnvironment()); const QFileInfo buildDirBinary{QDir{QCoreApplication::applicationDirPath()}, QStringLiteral("kwin_rules_dialog")}; diff --git a/src/useractions.cpp b/src/useractions.cpp index 4cffd5fd74..807367915f 100644 --- a/src/useractions.cpp +++ b/src/useractions.cpp @@ -311,7 +311,7 @@ void UserActionsMenu::init() args << QStringLiteral("--desktopfile") << path; } args << configModules(false); - QProcess *p = new Process(this); + QProcess *p = new QProcess(this); p->setArguments(args); p->setProcessEnvironment(kwinApp()->processStartupEnvironment()); p->setProgram(QStringLiteral("kcmshell5")); diff --git a/src/utils.cpp b/src/utils.cpp index 9d09532024..d8d71f2b63 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -28,7 +28,6 @@ #include "platform.h" #include "workspace.h" -#include #include #endif @@ -75,13 +74,6 @@ StrutRect &StrutRect::operator=(const StrutRect &other) #endif -Process::Process(QObject *parent) - : QProcess(parent) -{ -} - -Process::~Process() = default; - #ifndef KCMRULES void updateXTime() { @@ -140,15 +132,6 @@ void ungrabXKeyboard() xcb_ungrab_keyboard(connection(), XCB_TIME_CURRENT_TIME); } -void Process::setupChildProcess() -{ - sigset_t userSignals; - sigemptyset(&userSignals); - sigaddset(&userSignals, SIGUSR1); - sigaddset(&userSignals, SIGUSR2); - pthread_sigmask(SIG_UNBLOCK, &userSignals, nullptr); -} - #endif // converting between X11 mouse/keyboard state mask and Qt button/keyboard states diff --git a/src/utils.h b/src/utils.h index 1aaa95980d..fb9a087b74 100644 --- a/src/utils.h +++ b/src/utils.h @@ -23,7 +23,6 @@ #include #include #include -#include // system #include Q_DECLARE_LOGGING_CATEGORY(KWIN_CORE) @@ -170,22 +169,6 @@ Qt::MouseButton KWIN_EXPORT x11ToQtMouseButton(int button); Qt::MouseButtons KWIN_EXPORT x11ToQtMouseButtons(int state); Qt::KeyboardModifiers KWIN_EXPORT x11ToQtKeyboardModifiers(int state); -/** - * QProcess subclass which unblocks SIGUSR in the child process. - */ -class KWIN_EXPORT Process : public QProcess -{ - Q_OBJECT -public: - explicit Process(QObject *parent = nullptr); - ~Process() override; - -#ifndef KCMRULES -protected: - void setupChildProcess() override; -#endif -}; - /** * The DamageJournal class is a helper that tracks last N damage regions. */ diff --git a/src/xwl/xwayland.cpp b/src/xwl/xwayland.cpp index 28183bc8f9..3aeb1c7345 100644 --- a/src/xwl/xwayland.cpp +++ b/src/xwl/xwayland.cpp @@ -181,7 +181,7 @@ bool Xwayland::startInternal() arguments << QStringLiteral("-rootless"); arguments << QStringLiteral("-wm") << QString::number(fd); - m_xwaylandProcess = new Process(this); + m_xwaylandProcess = new QProcess(this); m_xwaylandProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel); m_xwaylandProcess->setProgram(QStringLiteral("Xwayland")); QProcessEnvironment env = m_app->processStartupEnvironment();