diff options
author | Bernd Weimer <bernd.weimer@qt.io> | 2023-01-30 16:33:54 +0100 |
---|---|---|
committer | Bernd Weimer <bernd.weimer@qt.io> | 2023-01-30 19:45:48 +0100 |
commit | 61e91284ade4ba7548e84e6550934aff5bcf1ca2 (patch) | |
tree | b455f1bae981d6b33e7cebe6b4599bbe37edfb14 | |
parent | d56b6983003e4e3aa2585fc7a4d1154404707472 (diff) | |
download | qtapplicationmanager-61e91284ade4ba7548e84e6550934aff5bcf1ca2.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).
Pick-to: 6.5 5.15
Change-Id: Id29d0e79e260726d1ffd9b940eac806b483b8a19
Reviewed-by: Robert Griebl <robert.griebl@qt.io>
-rw-r--r-- | src/tools/launcher-qml/launcher-qml.cpp | 5 |
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 351ec7f8..8ca08bb7 100644 --- a/src/tools/launcher-qml/launcher-qml.cpp +++ b/src/tools/launcher-qml/launcher-qml.cpp @@ -98,6 +98,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; |