diff options
author | BogDan Vatra <bogdan@kde.org> | 2015-10-14 14:18:58 +0300 |
---|---|---|
committer | BogDan Vatra <bogdan@kdab.com> | 2015-10-15 16:32:30 +0000 |
commit | 6fc1e0fc36f0732e79375a0e105816eb17893962 (patch) | |
tree | f172494ab3829af4fb73c299226abe74a5842527 /src/qml/qml | |
parent | dee31639b41a851129faa21d413ebece577f0cd8 (diff) |
Don't delete singletons objects owned by C++.
This way we can enable the usage of a single singletons in both
worlds. Currently singletons are destructed before the other QML
types, and using a singleton that is owned by C++ we don't need
to care about the destruction order anymore.
Change-Id: I120fcb8659e16321ae6e70c7b0d62be3bc650d73
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 26271e3f03..1a27a487bd 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -242,7 +242,12 @@ void QQmlType::SingletonInstanceInfo::destroy(QQmlEngine *e) // cleans up the engine-specific singleton instances if they exist. scriptApis.remove(e); QObject *o = qobjectApis.take(e); - delete o; + if (o) { + QQmlData *ddata = QQmlData::get(o, false); + if (ddata && ddata->indestructible) + return; + delete o; + } } void QQmlType::SingletonInstanceInfo::setQObjectApi(QQmlEngine *e, QObject *o) |