diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2024-04-05 11:04:30 +0800 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2024-04-09 10:58:47 +0800 |
commit | 8bdbe3d50f26d18d81acdb74703c73c419ad922b (patch) | |
tree | 5bbbaa315a3443c7a23248b5f95af9bdd847b274 /src/qml/qml | |
parent | 54e95d3fee5cc436b1574514ae96e4c1f36f797d (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 6.7
Change-Id: I121349fb310d683f5e5bee4b6a324a9ea8947b6b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlapplicationengine.cpp | 7 |
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 |