Unblock signals in child processes
We need to unblock the signals blocked with pthread_sigmask. This caused kdeinit to block, because it relies on SIGUSR1. BUG: 356580 FIXED-IN: 5.5.1 REVIEW: 126361
This commit is contained in:
parent
2f1731222a
commit
14b9046ad2
5 changed files with 39 additions and 6 deletions
|
@ -197,7 +197,7 @@ void ApplicationWayland::continueStartupWithX()
|
|||
environment.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("wayland"));
|
||||
environment.remove("DISPLAY");
|
||||
environment.remove("WAYLAND_DISPLAY");
|
||||
QProcess *p = new QProcess(this);
|
||||
QProcess *p = new Process(this);
|
||||
p->setProcessChannelMode(QProcess::ForwardedErrorChannel);
|
||||
auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished);
|
||||
connect(p, finishedSignal, this,
|
||||
|
@ -217,7 +217,7 @@ void ApplicationWayland::continueStartupWithX()
|
|||
m_environment.insert(QStringLiteral("DISPLAY"), QString::fromUtf8(qgetenv("DISPLAY")));
|
||||
// start session
|
||||
if (!m_sessionArgument.isEmpty()) {
|
||||
QProcess *p = new QProcess(this);
|
||||
QProcess *p = new Process(this);
|
||||
p->setProcessChannelMode(QProcess::ForwardedErrorChannel);
|
||||
p->setProcessEnvironment(m_environment);
|
||||
auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished);
|
||||
|
@ -229,7 +229,7 @@ void ApplicationWayland::continueStartupWithX()
|
|||
for (const QString &application: m_applicationsToStart) {
|
||||
// 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 QProcess(this);
|
||||
QProcess *p = new Process(this);
|
||||
p->setProcessChannelMode(QProcess::ForwardedErrorChannel);
|
||||
p->setProcessEnvironment(m_environment);
|
||||
p->start(application);
|
||||
|
@ -299,7 +299,7 @@ void ApplicationWayland::startXwaylandServer()
|
|||
|
||||
m_xcbConnectionFd = sx[0];
|
||||
|
||||
m_xwaylandProcess = new QProcess(kwinApp());
|
||||
m_xwaylandProcess = new Process(kwinApp());
|
||||
m_xwaylandProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel);
|
||||
m_xwaylandProcess->setProgram(QStringLiteral("Xwayland"));
|
||||
QProcessEnvironment env = m_environment;
|
||||
|
|
|
@ -1007,7 +1007,7 @@ void RuleBook::edit(AbstractClient* c, bool whole_app)
|
|||
args << QStringLiteral("--wid") << QString::number(c->window());
|
||||
if (whole_app)
|
||||
args << QStringLiteral("--whole-app");
|
||||
QProcess *p = new QProcess(this);
|
||||
QProcess *p = new Process(this);
|
||||
p->setArguments(args);
|
||||
p->setProcessEnvironment(kwinApp()->processStartupEnvironment());
|
||||
p->setProgram(QStringLiteral(KWIN_RULES_DIALOG_BIN));
|
||||
|
|
|
@ -330,7 +330,7 @@ void UserActionsMenu::init()
|
|||
// opens the KWin configuration
|
||||
QStringList args;
|
||||
args << QStringLiteral("--icon") << QStringLiteral("preferences-system-windows") << configModules(false);
|
||||
QProcess *p = new QProcess(this);
|
||||
QProcess *p = new Process(this);
|
||||
p->setArguments(args);
|
||||
p->setProcessEnvironment(kwinApp()->processStartupEnvironment());
|
||||
p->setProgram(QStringLiteral("kcmshell5"));
|
||||
|
|
18
utils.cpp
18
utils.cpp
|
@ -42,6 +42,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "atoms.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#endif
|
||||
|
||||
Q_LOGGING_CATEGORY(KWIN_CORE, "kwin_core", QtCriticalMsg)
|
||||
|
@ -142,6 +144,22 @@ void ungrabXKeyboard()
|
|||
xcb_ungrab_keyboard(connection(), XCB_TIME_CURRENT_TIME);
|
||||
}
|
||||
|
||||
Process::Process(QObject *parent)
|
||||
: QProcess(parent)
|
||||
{
|
||||
}
|
||||
|
||||
Process::~Process() = default;
|
||||
|
||||
void Process::setupChildProcess()
|
||||
{
|
||||
sigset_t userSiganls;
|
||||
sigemptyset(&userSiganls);
|
||||
sigaddset(&userSiganls, SIGUSR1);
|
||||
sigaddset(&userSiganls, SIGUSR2);
|
||||
pthread_sigmask(SIG_UNBLOCK, &userSiganls, nullptr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// converting between X11 mouse/keyboard state mask and Qt button/keyboard states
|
||||
|
|
15
utils.h
15
utils.h
|
@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include <QScopedPointer>
|
||||
#include <QProcess>
|
||||
// system
|
||||
#include <limits.h>
|
||||
Q_DECLARE_LOGGING_CATEGORY(KWIN_CORE)
|
||||
|
@ -227,6 +228,20 @@ private:
|
|||
bool m_valid = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* QProcess subclass which unblocks SIGUSR in the child process.
|
||||
**/
|
||||
class KWIN_EXPORT Process : public QProcess
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Process(QObject *parent = nullptr);
|
||||
virtual ~Process();
|
||||
|
||||
protected:
|
||||
void setupChildProcess() override;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
// Must be outside namespace
|
||||
|
|
Loading…
Reference in a new issue