summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiulio Camuffo <giuliocamuffo@gmail.com>2013-08-21 17:35:02 +0200
committerAndy Nichols <andy.nichols@digia.com>2013-08-22 14:09:25 +0200
commitabe1be628da687b1943a41e5411f34f646aeca86 (patch)
tree988491ad792793ffacbf18dbcced496931eec66b
parentc088945eb3a8b1ab6e81f33ce88b10f7a67792d0 (diff)
Quit when the wayland socket is closed.
wayland-client sets errno to EPIPE when the wayland connection is closed (int read_events(wl_display*) in wayland-client.c). Change-Id: Ifc984edf2fa018460f783a3af39c02ff08164860 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
-rw-r--r--src/plugins/platforms/wayland_common/qwaylanddisplay.cpp6
-rw-r--r--src/plugins/platforms/wayland_common/qwaylandeventthread.cpp4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/platforms/wayland_common/qwaylanddisplay.cpp b/src/plugins/platforms/wayland_common/qwaylanddisplay.cpp
index c18c21c3f..6cc01d0ed 100644
--- a/src/plugins/platforms/wayland_common/qwaylanddisplay.cpp
+++ b/src/plugins/platforms/wayland_common/qwaylanddisplay.cpp
@@ -162,13 +162,15 @@ QWaylandDisplay::~QWaylandDisplay(void)
void QWaylandDisplay::flushRequests()
{
- wl_display_dispatch_queue_pending(mDisplay, mEventQueue);
+ if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) == -1 && errno == EPIPE)
+ QCoreApplication::quit();
wl_display_flush(mDisplay);
}
void QWaylandDisplay::blockingReadEvents()
{
- wl_display_dispatch_queue(mDisplay, mEventQueue);
+ if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && errno == EPIPE)
+ QCoreApplication::quit();
}
QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const
diff --git a/src/plugins/platforms/wayland_common/qwaylandeventthread.cpp b/src/plugins/platforms/wayland_common/qwaylandeventthread.cpp
index 17fa7445c..ca968a2d0 100644
--- a/src/plugins/platforms/wayland_common/qwaylandeventthread.cpp
+++ b/src/plugins/platforms/wayland_common/qwaylandeventthread.cpp
@@ -1,5 +1,6 @@
#include "qwaylandeventthread.h"
#include <QtCore/QSocketNotifier>
+#include <QCoreApplication>
#include <unistd.h>
#include <fcntl.h>
@@ -31,7 +32,8 @@ void QWaylandEventThread::displayConnect()
void QWaylandEventThread::readWaylandEvents()
{
- wl_display_dispatch(m_display);
+ if (wl_display_dispatch(m_display) == -1 && errno == EPIPE)
+ QCoreApplication::quit();
emit newEventsRead();
}