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 <robin+qt@viroteck.net>
This commit is contained in:
Giulio Camuffo 2014-03-31 16:02:48 +03:00 committed by The Qt Project
parent 0431544ee3
commit 5d9ed010d5
2 changed files with 3 additions and 3 deletions

View File

@ -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);
}

View File

@ -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);
}