Client: Crash instead of exit when there's a wayland error

Qt applications should not call exit.

Task-number: QTBUG-75779
Change-Id: I91190b10f8c8e111996cd73283061e6ceaa6b1f6
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
This commit is contained in:
Johan Klokkhammer Helsing 2019-08-20 13:38:12 +02:00
parent f168c11529
commit d87b6d8231
2 changed files with 6 additions and 17 deletions

View File

@ -172,9 +172,9 @@ void QWaylandDisplay::checkError() const
int ecode = wl_display_get_error(mDisplay);
if ((ecode == EPIPE || ecode == ECONNRESET)) {
// special case this to provide a nicer error
qWarning("The Wayland connection broke. Did the Wayland compositor die?");
qFatal("The Wayland connection broke. Did the Wayland compositor die?");
} else {
qErrnoWarning(ecode, "The Wayland connection experienced a fatal error");
qFatal("The Wayland connection experienced a fatal error: %s", strerror(ecode));
}
}
@ -184,25 +184,16 @@ void QWaylandDisplay::flushRequests()
wl_display_read_events(mDisplay);
}
if (wl_display_dispatch_pending(mDisplay) < 0) {
if (wl_display_dispatch_pending(mDisplay) < 0)
checkError();
exitWithError();
}
wl_display_flush(mDisplay);
}
void QWaylandDisplay::blockingReadEvents()
{
if (wl_display_dispatch(mDisplay) < 0) {
if (wl_display_dispatch(mDisplay) < 0)
checkError();
exitWithError();
}
}
void QWaylandDisplay::exitWithError()
{
::exit(1);
}
wl_event_queue *QWaylandDisplay::createEventQueue()
@ -231,10 +222,9 @@ void QWaylandDisplay::dispatchQueueWhile(wl_event_queue *queue, std::function<bo
else
wl_display_cancel_read(mDisplay);
if (wl_display_dispatch_queue_pending(mDisplay, queue) < 0) {
if (wl_display_dispatch_queue_pending(mDisplay, queue) < 0)
checkError();
exitWithError();
}
if (!condition())
break;
}

View File

@ -191,7 +191,6 @@ public slots:
private:
void waitForScreens();
void exitWithError();
void checkError() const;
void handleWaylandSync();