diff options
author | Robert Griebl <robert.griebl@pelagicore.com> | 2015-03-24 22:28:34 +0100 |
---|---|---|
committer | Robert Griebl <robert.griebl@pelagicore.com> | 2015-04-15 09:47:56 +0000 |
commit | 37a76c2a0bd36ccb472fa36425a910d236cdda28 (patch) | |
tree | 253ddf28ff13ba0b8567d3c026c3a7be3992cb71 /src | |
parent | 175772b3de48f7b24d6ab28255eed28e7cb53eb1 (diff) |
Unregister types in the QMetaType system on unload.
This patch will enable the unregistering of previously registered
QMetaTypes, when the corresponding Qml type is dead.
The API for this was added to QtBase with b00201b.
Change-Id: I96d4a3004d8da59ee8edf7cfd6d2fef3a5410807
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 70090bd3f9..2361274e5f 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -617,8 +617,14 @@ QQmlEnginePrivate::~QQmlEnginePrivate() for (TypePropertyCacheIt iter = typePropertyCache.begin(), end = typePropertyCache.end(); iter != end; ++iter) (*iter)->release(); - for (CompositeTypesIt iter = m_compositeTypes.begin(), end = m_compositeTypes.end(); iter != end; ++iter) + for (CompositeTypesIt iter = m_compositeTypes.begin(), end = m_compositeTypes.end(); iter != end; ++iter) { iter.value()->isRegisteredWithEngine = false; + + // since unregisterInternalCompositeType() will not be called in this + // case, we have to clean up the type registration manually + QMetaType::unregisterType(iter.value()->metaTypeId); + QMetaType::unregisterType(iter.value()->listMetaTypeId); + } delete profiler; } @@ -2311,6 +2317,9 @@ void QQmlEnginePrivate::unregisterInternalCompositeType(QQmlCompiledData *data) Locker locker(this); m_qmlLists.remove(lst_type); m_compositeTypes.remove(ptr_type); + + QMetaType::unregisterType(ptr_type); + QMetaType::unregisterType(lst_type); } bool QQmlEnginePrivate::isTypeLoaded(const QUrl &url) const |