summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylanddisplay.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@viroteck.net>2014-08-19 18:24:56 +0200
committerRobin Burchell <robin.burchell@viroteck.net>2014-08-19 18:46:05 +0200
commitcee3e127f4c9d57a00c55d57957a99c7061aa863 (patch)
tree310bbaa4f73619af4aac68911facf7d13244b940 /src/client/qwaylanddisplay.cpp
parent58bc9a98d4c1e8b40be41b31833e535ddbf9f12a (diff)
QWaylandDisplay: Correctly intercept all errors when dispatching.
A connection reset isn't the only form of error we may run into, so make sure we check for other exceptional circumstances through wl_display_get_error. This fixes my case of e.g. wl_drm throwing an error but QtWayland never quitting the client. Change-Id: I8c76dd7913640e58d03bd2fe52eb054a4daa0235 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Diffstat (limited to 'src/client/qwaylanddisplay.cpp')
-rw-r--r--src/client/qwaylanddisplay.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 242a13a15..74efbfda4 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -166,18 +166,31 @@ QWaylandDisplay::~QWaylandDisplay(void)
void QWaylandDisplay::flushRequests()
{
- if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) == -1 && (errno == EPIPE || errno == ECONNRESET)) {
- qWarning("The Wayland connection broke. Did the Wayland compositor die?");
+ if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0) {
+ 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?");
+ } else {
+ qErrnoWarning(ecode, "The Wayland connection experienced a fatal error");
+ }
::exit(1);
}
+
wl_display_flush(mDisplay);
}
void QWaylandDisplay::blockingReadEvents()
{
- if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && (errno == EPIPE || errno == ECONNRESET)) {
- qWarning("The Wayland connection broke. Did the Wayland compositor die?");
+ if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0) {
+ 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?");
+ } else {
+ qErrnoWarning(ecode, "The Wayland connection experienced a fatal error");
+ }
::exit(1);
}
}