diff options
author | Robert Griebl <robert.griebl@qt.io> | 2024-01-25 15:20:09 +0100 |
---|---|---|
committer | Robert Griebl <robert.griebl@qt.io> | 2024-01-25 15:25:08 +0100 |
commit | 9dd4bc6e846d4888dcfd433caa21211561ae55ab (patch) | |
tree | 48bf2dcb56d790277428a89e7e66cc0e255cf78a | |
parent | 3532e9baec3b8ee5db6cc802a7703ce4a69de970 (diff) |
Fix QML debugger freeze on exit
We need to make sure that the QML engine dies before the qApp instance,
because otherwise the QML debugger thread's event loop is quit from too
early.
Change-Id: I57df9011dd4a1347289f9e17876c9b86217ba024
Pick-to: 6.7
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
-rw-r--r-- | src/tools/launcher-qml/launcher-qml.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tools/launcher-qml/launcher-qml.cpp b/src/tools/launcher-qml/launcher-qml.cpp index a8d217ca..3163f547 100644 --- a/src/tools/launcher-qml/launcher-qml.cpp +++ b/src/tools/launcher-qml/launcher-qml.cpp @@ -114,6 +114,8 @@ int main(int argc, char *argv[]) StartupTimer::instance()->checkpoint("after basic initialization"); + std::unique_ptr<Controller> controller; // this needs to die BEFORE qApp does + if (!directLoadManifest.isEmpty()) { QString directLoadAppId; qsizetype appPos = directLoadManifest.indexOf(u"@"_s); @@ -126,11 +128,11 @@ int main(int argc, char *argv[]) if (!fi.exists() || fi.fileName() != u"info.yaml"_s) throw Exception("--directload needs a valid info.yaml file as parameter"); directLoadManifest = fi.absoluteFilePath(); - new Controller(&am, quicklaunched, qMakePair(directLoadManifest, directLoadAppId)); + controller.reset(new Controller(&am, quicklaunched, qMakePair(directLoadManifest, directLoadAppId))); } else { am.setupDBusConnections(); StartupTimer::instance()->checkpoint("after dbus initialization"); - new Controller(&am, quicklaunched); + controller.reset(new Controller(&am, quicklaunched)); } return am.exec(); |