summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Weimer <bernd.weimer@qt.io>2023-01-30 16:33:54 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-01-31 09:13:42 +0000
commitf60ced52e489a6be661025984598ae633a63c136 (patch)
tree6a965f37ca4e7a6a4bb5d5c3ee27bd6af117e340
parent96dcc5834471a6a7718e2bba8690b98079b3e678 (diff)
downloadqtapplicationmanager-f60ced52e489a6be661025984598ae633a63c136.tar.gz
Handle missing wayland display gracefully
When the wayland socket didn't exist, the appman-launcher-qml would terminate with an abort. This could happen for instance inside a container when the socket file was not mapped. This has been mitigated to only show a critical error message in the am.runtime.qml logging category and exit gracefully (with an error return code). Change-Id: Id29d0e79e260726d1ffd9b940eac806b483b8a19 Reviewed-by: Robert Griebl <robert.griebl@qt.io> (cherry picked from commit 61e91284ade4ba7548e84e6550934aff5bcf1ca2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/tools/launcher-qml/launcher-qml.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/launcher-qml/launcher-qml.cpp b/src/tools/launcher-qml/launcher-qml.cpp
index 76b52d9c..caf57c32 100644
--- a/src/tools/launcher-qml/launcher-qml.cpp
+++ b/src/tools/launcher-qml/launcher-qml.cpp
@@ -144,6 +144,11 @@ int main(int argc, char *argv[])
Logging::initialize();
try {
+ const QString socket = QDir(qEnvironmentVariable("XDG_RUNTIME_DIR"))
+ .filePath(qEnvironmentVariable("WAYLAND_DISPLAY"));
+ if (!QFileInfo::exists(socket))
+ throw Exception("Cannot start application: no wayland display - expected socket at: %1").arg(socket);
+
LauncherMain::initialize();
Application app(argc, argv);
LauncherMain launcher;