xwayland: Replace criticalError() signal with a less fatal signal
If the Xwayland executable can't be found, the whole session will die because a criticalError() signal will be emitted. This change replaces the criticalError() signal with a less severe signal. If the errorOccurred() signal has been emitted during the startup sequence, kwin won't die and will just continue with spawning the session process.
This commit is contained in:
parent
6dbc060596
commit
b13a74c908
4 changed files with 16 additions and 22 deletions
|
@ -151,6 +151,7 @@ void WaylandTestApplication::continueStartupWithScreens()
|
||||||
void WaylandTestApplication::finalizeStartup()
|
void WaylandTestApplication::finalizeStartup()
|
||||||
{
|
{
|
||||||
if (m_xwayland) {
|
if (m_xwayland) {
|
||||||
|
disconnect(m_xwayland, &Xwl::Xwayland::errorOccurred, this, &WaylandTestApplication::finalizeStartup);
|
||||||
disconnect(m_xwayland, &Xwl::Xwayland::started, this, &WaylandTestApplication::finalizeStartup);
|
disconnect(m_xwayland, &Xwl::Xwayland::started, this, &WaylandTestApplication::finalizeStartup);
|
||||||
}
|
}
|
||||||
notifyStarted();
|
notifyStarted();
|
||||||
|
@ -172,12 +173,7 @@ void WaylandTestApplication::continueStartupWithScene()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_xwayland = new Xwl::Xwayland(this);
|
m_xwayland = new Xwl::Xwayland(this);
|
||||||
connect(m_xwayland, &Xwl::Xwayland::criticalError, this, [](int code) {
|
connect(m_xwayland, &Xwl::Xwayland::errorOccurred, this, &WaylandTestApplication::finalizeStartup);
|
||||||
// we currently exit on Xwayland errors always directly
|
|
||||||
// TODO: restart Xwayland
|
|
||||||
std::cerr << "Xwayland had a critical error. Going to exit now." << std::endl;
|
|
||||||
exit(code);
|
|
||||||
});
|
|
||||||
connect(m_xwayland, &Xwl::Xwayland::started, this, &WaylandTestApplication::finalizeStartup);
|
connect(m_xwayland, &Xwl::Xwayland::started, this, &WaylandTestApplication::finalizeStartup);
|
||||||
m_xwayland->start();
|
m_xwayland->start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,6 +180,7 @@ void ApplicationWayland::continueStartupWithScreens()
|
||||||
void ApplicationWayland::finalizeStartup()
|
void ApplicationWayland::finalizeStartup()
|
||||||
{
|
{
|
||||||
if (m_xwayland) {
|
if (m_xwayland) {
|
||||||
|
disconnect(m_xwayland, &Xwl::Xwayland::errorOccurred, this, &ApplicationWayland::finalizeStartup);
|
||||||
disconnect(m_xwayland, &Xwl::Xwayland::started, this, &ApplicationWayland::finalizeStartup);
|
disconnect(m_xwayland, &Xwl::Xwayland::started, this, &ApplicationWayland::finalizeStartup);
|
||||||
}
|
}
|
||||||
startSession();
|
startSession();
|
||||||
|
@ -203,12 +204,7 @@ void ApplicationWayland::continueStartupWithScene()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_xwayland = new Xwl::Xwayland(this);
|
m_xwayland = new Xwl::Xwayland(this);
|
||||||
connect(m_xwayland, &Xwl::Xwayland::criticalError, this, [](int code) {
|
connect(m_xwayland, &Xwl::Xwayland::errorOccurred, this, &ApplicationWayland::finalizeStartup);
|
||||||
// we currently exit on Xwayland errors always directly
|
|
||||||
// TODO: restart Xwayland
|
|
||||||
std::cerr << "Xwayland had a critical error. Going to exit now." << std::endl;
|
|
||||||
exit(code);
|
|
||||||
});
|
|
||||||
connect(m_xwayland, &Xwl::Xwayland::started, this, &ApplicationWayland::finalizeStartup);
|
connect(m_xwayland, &Xwl::Xwayland::started, this, &ApplicationWayland::finalizeStartup);
|
||||||
m_xwayland->start();
|
m_xwayland->start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,32 +91,32 @@ void Xwayland::start()
|
||||||
int pipeFds[2];
|
int pipeFds[2];
|
||||||
if (pipe(pipeFds) != 0) {
|
if (pipe(pipeFds) != 0) {
|
||||||
std::cerr << "FATAL ERROR failed to create pipe to start Xwayland " << std::endl;
|
std::cerr << "FATAL ERROR failed to create pipe to start Xwayland " << std::endl;
|
||||||
Q_EMIT criticalError(1);
|
emit errorOccurred();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int sx[2];
|
int sx[2];
|
||||||
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sx) < 0) {
|
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sx) < 0) {
|
||||||
std::cerr << "FATAL ERROR: failed to open socket to open XCB connection" << std::endl;
|
std::cerr << "FATAL ERROR: failed to open socket to open XCB connection" << std::endl;
|
||||||
Q_EMIT criticalError(1);
|
emit errorOccurred();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int fd = dup(sx[1]);
|
int fd = dup(sx[1]);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
std::cerr << "FATAL ERROR: failed to open socket to open XCB connection" << std::endl;
|
std::cerr << "FATAL ERROR: failed to open socket to open XCB connection" << std::endl;
|
||||||
Q_EMIT criticalError(20);
|
emit errorOccurred();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int waylandSocket = waylandServer()->createXWaylandConnection();
|
const int waylandSocket = waylandServer()->createXWaylandConnection();
|
||||||
if (waylandSocket == -1) {
|
if (waylandSocket == -1) {
|
||||||
std::cerr << "FATAL ERROR: failed to open socket for Xwayland" << std::endl;
|
std::cerr << "FATAL ERROR: failed to open socket for Xwayland" << std::endl;
|
||||||
Q_EMIT criticalError(1);
|
emit errorOccurred();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const int wlfd = dup(waylandSocket);
|
const int wlfd = dup(waylandSocket);
|
||||||
if (wlfd < 0) {
|
if (wlfd < 0) {
|
||||||
std::cerr << "FATAL ERROR: failed to open socket for Xwayland" << std::endl;
|
std::cerr << "FATAL ERROR: failed to open socket for Xwayland" << std::endl;
|
||||||
Q_EMIT criticalError(20);
|
emit errorOccurred();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,6 @@ void Xwayland::handleXwaylandError(QProcess::ProcessError error)
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case QProcess::FailedToStart:
|
case QProcess::FailedToStart:
|
||||||
qCWarning(KWIN_XWL) << "Xwayland process failed to start";
|
qCWarning(KWIN_XWL) << "Xwayland process failed to start";
|
||||||
emit criticalError(1);
|
|
||||||
return;
|
return;
|
||||||
case QProcess::Crashed:
|
case QProcess::Crashed:
|
||||||
qCWarning(KWIN_XWL) << "Xwayland process crashed";
|
qCWarning(KWIN_XWL) << "Xwayland process crashed";
|
||||||
|
@ -295,6 +294,7 @@ void Xwayland::handleXwaylandError(QProcess::ProcessError error)
|
||||||
qCWarning(KWIN_XWL) << "An unknown error has occurred in Xwayland";
|
qCWarning(KWIN_XWL) << "An unknown error has occurred in Xwayland";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
emit errorOccurred();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Xwayland::createX11Connection()
|
bool Xwayland::createX11Connection()
|
||||||
|
@ -353,8 +353,7 @@ void Xwayland::destroyX11Connection()
|
||||||
void Xwayland::continueStartupWithX()
|
void Xwayland::continueStartupWithX()
|
||||||
{
|
{
|
||||||
if (!createX11Connection()) {
|
if (!createX11Connection()) {
|
||||||
// about to quit
|
emit errorOccurred();
|
||||||
Q_EMIT criticalError(1);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public Q_SLOTS:
|
||||||
* Starts the Xwayland server.
|
* Starts the Xwayland server.
|
||||||
*
|
*
|
||||||
* This method will spawn an Xwayland process and will establish a new XCB connection to it.
|
* This method will spawn an Xwayland process and will establish a new XCB connection to it.
|
||||||
* If a fatal error has occurred during the startup, the criticalError() signal is going to
|
* If an error has occurred during the startup, the errorOccurred() signal is going to
|
||||||
* be emitted. If the Xwayland server has started successfully, the started() signal will be
|
* be emitted. If the Xwayland server has started successfully, the started() signal will be
|
||||||
* emitted.
|
* emitted.
|
||||||
*
|
*
|
||||||
|
@ -72,7 +72,10 @@ Q_SIGNALS:
|
||||||
* ready to accept and manage X11 clients.
|
* ready to accept and manage X11 clients.
|
||||||
*/
|
*/
|
||||||
void started();
|
void started();
|
||||||
void criticalError(int code);
|
/**
|
||||||
|
* This signal is emitted when an error occurs with the Xwayland server.
|
||||||
|
*/
|
||||||
|
void errorOccurred();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void dispatchEvents();
|
void dispatchEvents();
|
||||||
|
|
Loading…
Reference in a new issue