Drop Process helper

Direct session is long time gone and SIGUSR1 and SIGUSR2 are not used
anywhere so drop the Process helper.
This commit is contained in:
Vlad Zahorodnii 2022-01-10 22:30:37 +02:00
parent 2979a850fa
commit 8e8f55b18a
7 changed files with 6 additions and 46 deletions

View file

@ -690,7 +690,7 @@ void InputMethod::startInputMethod()
environment.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("wayland")); environment.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("wayland"));
environment.remove("WAYLAND_DISPLAY"); environment.remove("WAYLAND_DISPLAY");
m_inputMethodProcess = new Process(this); m_inputMethodProcess = new QProcess(this);
m_inputMethodProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel); m_inputMethodProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel);
m_inputMethodProcess->setProcessEnvironment(environment); m_inputMethodProcess->setProcessEnvironment(environment);
m_inputMethodProcess->setProgram(program); m_inputMethodProcess->setProgram(program);

View file

@ -231,7 +231,7 @@ void ApplicationWayland::startSession()
QStringList arguments = KShell::splitArgs(m_sessionArgument); QStringList arguments = KShell::splitArgs(m_sessionArgument);
if (!arguments.isEmpty()) { if (!arguments.isEmpty()) {
QString program = arguments.takeFirst(); QString program = arguments.takeFirst();
QProcess *p = new Process(this); QProcess *p = new QProcess(this);
p->setProcessChannelMode(QProcess::ForwardedErrorChannel); p->setProcessChannelMode(QProcess::ForwardedErrorChannel);
p->setProcessEnvironment(processStartupEnvironment()); p->setProcessEnvironment(processStartupEnvironment());
connect(p, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, [p] (int code, QProcess::ExitStatus status) { connect(p, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, [p] (int code, QProcess::ExitStatus status) {
@ -268,7 +268,7 @@ void ApplicationWayland::startSession()
QString program = arguments.takeFirst(); QString program = arguments.takeFirst();
// note: this will kill the started process when we exit // 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 // 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->setProcessChannelMode(QProcess::ForwardedErrorChannel);
p->setProcessEnvironment(processStartupEnvironment()); p->setProcessEnvironment(processStartupEnvironment());
p->setProgram(program); p->setProgram(program);
@ -377,12 +377,6 @@ int main(int argc, char * argv[])
signal(SIGABRT, KWin::unsetDumpable); signal(SIGABRT, KWin::unsetDumpable);
signal(SIGSEGV, KWin::unsetDumpable); signal(SIGSEGV, KWin::unsetDumpable);
signal(SIGPIPE, SIG_IGN); 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(); QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();

View file

@ -1003,7 +1003,7 @@ void RuleBook::edit(AbstractClient* c, bool whole_app)
args << QStringLiteral("--uuid") << c->internalId().toString(); args << QStringLiteral("--uuid") << c->internalId().toString();
if (whole_app) if (whole_app)
args << QStringLiteral("--whole-app"); args << QStringLiteral("--whole-app");
QProcess *p = new Process(this); QProcess *p = new QProcess(this);
p->setArguments(args); p->setArguments(args);
p->setProcessEnvironment(kwinApp()->processStartupEnvironment()); p->setProcessEnvironment(kwinApp()->processStartupEnvironment());
const QFileInfo buildDirBinary{QDir{QCoreApplication::applicationDirPath()}, QStringLiteral("kwin_rules_dialog")}; const QFileInfo buildDirBinary{QDir{QCoreApplication::applicationDirPath()}, QStringLiteral("kwin_rules_dialog")};

View file

@ -311,7 +311,7 @@ void UserActionsMenu::init()
args << QStringLiteral("--desktopfile") << path; args << QStringLiteral("--desktopfile") << path;
} }
args << configModules(false); args << configModules(false);
QProcess *p = new Process(this); QProcess *p = new QProcess(this);
p->setArguments(args); p->setArguments(args);
p->setProcessEnvironment(kwinApp()->processStartupEnvironment()); p->setProcessEnvironment(kwinApp()->processStartupEnvironment());
p->setProgram(QStringLiteral("kcmshell5")); p->setProgram(QStringLiteral("kcmshell5"));

View file

@ -28,7 +28,6 @@
#include "platform.h" #include "platform.h"
#include "workspace.h" #include "workspace.h"
#include <csignal>
#include <cstdio> #include <cstdio>
#endif #endif
@ -75,13 +74,6 @@ StrutRect &StrutRect::operator=(const StrutRect &other)
#endif #endif
Process::Process(QObject *parent)
: QProcess(parent)
{
}
Process::~Process() = default;
#ifndef KCMRULES #ifndef KCMRULES
void updateXTime() void updateXTime()
{ {
@ -140,15 +132,6 @@ void ungrabXKeyboard()
xcb_ungrab_keyboard(connection(), XCB_TIME_CURRENT_TIME); 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 #endif
// converting between X11 mouse/keyboard state mask and Qt button/keyboard states // converting between X11 mouse/keyboard state mask and Qt button/keyboard states

View file

@ -23,7 +23,6 @@
#include <QPoint> #include <QPoint>
#include <QRect> #include <QRect>
#include <QScopedPointer> #include <QScopedPointer>
#include <QProcess>
// system // system
#include <climits> #include <climits>
Q_DECLARE_LOGGING_CATEGORY(KWIN_CORE) 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::MouseButtons KWIN_EXPORT x11ToQtMouseButtons(int state);
Qt::KeyboardModifiers KWIN_EXPORT x11ToQtKeyboardModifiers(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. * The DamageJournal class is a helper that tracks last N damage regions.
*/ */

View file

@ -181,7 +181,7 @@ bool Xwayland::startInternal()
arguments << QStringLiteral("-rootless"); arguments << QStringLiteral("-rootless");
arguments << QStringLiteral("-wm") << QString::number(fd); arguments << QStringLiteral("-wm") << QString::number(fd);
m_xwaylandProcess = new Process(this); m_xwaylandProcess = new QProcess(this);
m_xwaylandProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel); m_xwaylandProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel);
m_xwaylandProcess->setProgram(QStringLiteral("Xwayland")); m_xwaylandProcess->setProgram(QStringLiteral("Xwayland"));
QProcessEnvironment env = m_app->processStartupEnvironment(); QProcessEnvironment env = m_app->processStartupEnvironment();