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:
parent
f168c11529
commit
d87b6d8231
@ -172,9 +172,9 @@ void QWaylandDisplay::checkError() const
|
|||||||
int ecode = wl_display_get_error(mDisplay);
|
int ecode = wl_display_get_error(mDisplay);
|
||||||
if ((ecode == EPIPE || ecode == ECONNRESET)) {
|
if ((ecode == EPIPE || ecode == ECONNRESET)) {
|
||||||
// special case this to provide a nicer error
|
// 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 {
|
} 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);
|
wl_display_read_events(mDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wl_display_dispatch_pending(mDisplay) < 0) {
|
if (wl_display_dispatch_pending(mDisplay) < 0)
|
||||||
checkError();
|
checkError();
|
||||||
exitWithError();
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_display_flush(mDisplay);
|
wl_display_flush(mDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandDisplay::blockingReadEvents()
|
void QWaylandDisplay::blockingReadEvents()
|
||||||
{
|
{
|
||||||
if (wl_display_dispatch(mDisplay) < 0) {
|
if (wl_display_dispatch(mDisplay) < 0)
|
||||||
checkError();
|
checkError();
|
||||||
exitWithError();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWaylandDisplay::exitWithError()
|
|
||||||
{
|
|
||||||
::exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_event_queue *QWaylandDisplay::createEventQueue()
|
wl_event_queue *QWaylandDisplay::createEventQueue()
|
||||||
@ -231,10 +222,9 @@ void QWaylandDisplay::dispatchQueueWhile(wl_event_queue *queue, std::function<bo
|
|||||||
else
|
else
|
||||||
wl_display_cancel_read(mDisplay);
|
wl_display_cancel_read(mDisplay);
|
||||||
|
|
||||||
if (wl_display_dispatch_queue_pending(mDisplay, queue) < 0) {
|
if (wl_display_dispatch_queue_pending(mDisplay, queue) < 0)
|
||||||
checkError();
|
checkError();
|
||||||
exitWithError();
|
|
||||||
}
|
|
||||||
if (!condition())
|
if (!condition())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,6 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void waitForScreens();
|
void waitForScreens();
|
||||||
void exitWithError();
|
|
||||||
void checkError() const;
|
void checkError() const;
|
||||||
|
|
||||||
void handleWaylandSync();
|
void handleWaylandSync();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user