From 2e4993fe61a2cbd01549c953701a9ac551c3d992 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 30 Jul 2013 15:27:31 -0700 Subject: Clean up objects in QQmlApplicationEngine earlier Deleting the objects in the private class destructor leads to crashes in V8 because the JS engine is in the middle of being deleted. Instead, delete the objects in the public class destructor so that it occurs before the actual engine cleanup starts to happen. Change-Id: I6bac813ce188be54842a78d7b532fcf2d54dc444 Reviewed-by: Shawn Rutledge --- src/qml/qml/qqmlapplicationengine.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/qml/qml/qqmlapplicationengine.cpp') diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp index 9181dad519..85aeaf5786 100644 --- a/src/qml/qml/qqmlapplicationengine.cpp +++ b/src/qml/qml/qqmlapplicationengine.cpp @@ -53,6 +53,10 @@ QQmlApplicationEnginePrivate::QQmlApplicationEnginePrivate(QQmlEngine *e) } QQmlApplicationEnginePrivate::~QQmlApplicationEnginePrivate() +{ +} + +void QQmlApplicationEnginePrivate::cleanUp() { qDeleteAll(objects); #ifndef QT_NO_TRANSLATIONS @@ -229,7 +233,8 @@ QQmlApplicationEngine::QQmlApplicationEngine(const QString &filePath, QObject *p */ QQmlApplicationEngine::~QQmlApplicationEngine() { - //Instantiated root objects cleaned up in private class + Q_D(QQmlApplicationEngine); + d->cleanUp();//Instantiated root objects must be deleted before the engine } /*! -- cgit v1.2.3