summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-08-20 13:38:12 +0200
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-08-22 11:59:48 +0200
commitf5a28afe4c2cb82540c94616e7a9e3e72e0e8327 (patch)
treebc992025bbc36e82cb5fda223d6dd7f45d2b2718
parent70473e7d3b7820ba171ee67bc0098906a2a59fe4 (diff)
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>
-rw-r--r--src/client/qwaylanddisplay.cpp22
-rw-r--r--src/client/qwaylanddisplay_p.h1
2 files changed, 6 insertions, 17 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 82003a308..47b107e80 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -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;
}
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index 6bf6abd5d..ae8ec0ab8 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -191,7 +191,6 @@ public slots:
private:
void waitForScreens();
- void exitWithError();
void checkError() const;
void handleWaylandSync();