From 5d9ed010d56b1f672a4a97045b7dd0bdc3f65670 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 31 Mar 2014 16:02:48 +0300 Subject: [PATCH] Always bail out when the compositor is closed errno can both be EPIPE and ECONNRESET when reading from the connection after the server is closed. Change-Id: I03b64a382db3de66819277e9955aeca3e2d7f9a1 Reviewed-by: Robin Burchell --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylandeventthread.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 0b715c0ae2c..3576c0bd2aa 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -149,7 +149,7 @@ QWaylandDisplay::~QWaylandDisplay(void) void QWaylandDisplay::flushRequests() { - if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) == -1 && errno == EPIPE) { + if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) == -1 && (errno == EPIPE || errno == ECONNRESET)) { qWarning("The Wayland connection broke. Did the Wayland compositor die?"); ::exit(1); } @@ -159,7 +159,7 @@ void QWaylandDisplay::flushRequests() void QWaylandDisplay::blockingReadEvents() { - if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && errno == EPIPE) { + if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && (errno == EPIPE || errno == ECONNRESET)) { qWarning("The Wayland connection broke. Did the Wayland compositor die?"); ::exit(1); } diff --git a/src/plugins/platforms/wayland/qwaylandeventthread.cpp b/src/plugins/platforms/wayland/qwaylandeventthread.cpp index b94110c25ef..d309f7bb234 100644 --- a/src/plugins/platforms/wayland/qwaylandeventthread.cpp +++ b/src/plugins/platforms/wayland/qwaylandeventthread.cpp @@ -32,7 +32,7 @@ void QWaylandEventThread::displayConnect() void QWaylandEventThread::readWaylandEvents() { - if (wl_display_dispatch(m_display) == -1 && errno == EPIPE) { + if (wl_display_dispatch(m_display) == -1 && (errno == EPIPE || errno == ECONNRESET)) { qWarning("The Wayland connection broke. Did the Wayland compositor die?"); ::exit(1); }