summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylanddisplay.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-02-14 16:22:25 +0100
committerJohan Helsing <johan.helsing@qt.io>2018-02-26 15:59:45 +0000
commit72999738489b5251d025c954a77c93e8e1fdfd9d (patch)
tree1e17836dea84c49e078aacbc3a363ca305dbe605 /src/client/qwaylanddisplay.cpp
parent5b69d5f05fdf187ae8a5f08e9a57375cbbd7f142 (diff)
Client: Fail gracefully when wl_display_connect fails
[ChangeLog][QPA plugin] If we're unable to create a connection to the Wayland display, fail gracefully so other platform integrations can be tried instead. This also adds QWaylandIntegration::hasFailed() which can later be extended to report that the platform plugin is unusable for other reasons. I.e. no compatible shell extensions or similar. Task-number: QTBUG-59762 Change-Id: I0f1ae73982e2860814235c1a189741d130e1db3e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/client/qwaylanddisplay.cpp')
-rw-r--r--src/client/qwaylanddisplay.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 942494f93..179c0454e 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -142,9 +142,9 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
qRegisterMetaType<uint32_t>("uint32_t");
mDisplay = wl_display_connect(nullptr);
- if (mDisplay == nullptr) {
- qErrnoWarning(errno, "Failed to create display");
- ::exit(1);
+ if (!mDisplay) {
+ qErrnoWarning(errno, "Failed to create wl_display");
+ return;
}
struct ::wl_registry *registry = wl_display_get_registry(mDisplay);
@@ -170,7 +170,8 @@ QWaylandDisplay::~QWaylandDisplay(void)
#if QT_CONFIG(wayland_datadevice)
delete mDndSelectionHandler.take();
#endif
- wl_display_disconnect(mDisplay);
+ if (mDisplay)
+ wl_display_disconnect(mDisplay);
}
void QWaylandDisplay::checkError() const