summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylanddisplay.cpp
diff options
context:
space:
mode:
authorGiulio Camuffo <giulio.camuffo@jollamobile.com>2014-10-02 10:48:09 +0300
committerGiulio Camuffo <giulio.camuffo@jollamobile.com>2014-10-02 11:36:52 +0200
commitc7a8b70b4e9afef864652cf98a934d99d49bb36f (patch)
treed77c921f4465b8bd1f96b3b57750477a15c09f8b /src/client/qwaylanddisplay.cpp
parentd480db141ec78ed85b299910d3796b4232264bc4 (diff)
Call ::exit() from the gui thread only
::exit() is not thread safe, so make sure to not call it more than one time, once from the gui thread and once from the wayland event thread. Change-Id: I80905c6d996cb827a5101ae6d6c9bc12a267ba71 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src/client/qwaylanddisplay.cpp')
-rw-r--r--src/client/qwaylanddisplay.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 3eac985f6..8649a497c 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -149,6 +149,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
init(registry);
connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests()));
+ connect(mEventThreadObject, &QWaylandEventThread::fatalError, this, &QWaylandDisplay::exitWithError);
mWindowManagerIntegration.reset(new QWaylandWindowManagerIntegration(this));
@@ -167,8 +168,10 @@ QWaylandDisplay::~QWaylandDisplay(void)
void QWaylandDisplay::flushRequests()
{
- if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0)
- mEventThreadObject->checkErrorAndExit();
+ if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0) {
+ mEventThreadObject->checkError();
+ exitWithError();
+ }
wl_display_flush(mDisplay);
}
@@ -176,8 +179,15 @@ void QWaylandDisplay::flushRequests()
void QWaylandDisplay::blockingReadEvents()
{
- if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0)
- mEventThreadObject->checkErrorAndExit();
+ if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0) {
+ mEventThreadObject->checkError();
+ exitWithError();
+ }
+}
+
+void QWaylandDisplay::exitWithError()
+{
+ ::exit(1);
}
QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const