aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2024-04-05 11:04:30 +0800
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-04-09 05:17:54 +0000
commitad3409a9dfe31ee7b710221be41a611ce79a2471 (patch)
treeb7bacce38ac44d7602f34fe2289f31bcb919e4de
parentd2a839f84572542bbee15d50da99464a6433b02c (diff)
Doc: don't use quit in snippet that exits upon load failure
quit is for a successful exit. Failure to load QML is an error and should be treated as such. Pick-to: 6.5 Change-Id: I121349fb310d683f5e5bee4b6a324a9ea8947b6b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 8bdbe3d50f26d18d81acdb74703c73c419ad922b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/qml/qml/qqmlapplicationengine.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp
index e2d9dceb16..82cc335c8e 100644
--- a/src/qml/qml/qqmlapplicationengine.cpp
+++ b/src/qml/qml/qqmlapplicationengine.cpp
@@ -257,10 +257,9 @@ void QQmlApplicationEnginePrivate::ensureLoadingFinishes(QQmlComponent *c)
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
- // quit on error
- QObject::connect(&engine, QQmlApplicationEngine::objectCreationFailed,
- QCoreApplication::instance(), QCoreApplication::quit,
- Qt::QueuedConnection);
+ // exit on error
+ QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
+ &app, []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection);
engine.load(QUrl());
return app.exec();
\endcode