diff options
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 804becccc2..4f84fa6be4 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -1338,15 +1338,29 @@ void QQmlTypeLoader::trimCache() // typeData->m_compiledData may be set early on in the proccess of loading a file, so // it's important to check the general loading status of the typeData before making any // other decisions. - if (typeData->count() == 1 && (typeData->isError() || typeData->isComplete()) - && (!typeData->m_compiledData || typeData->m_compiledData->count() == 1)) { - // There are no live objects of this type - iter.value()->release(); - iter = m_typeCache.erase(iter); - deletedOneType = true; - } else { + if (typeData->count() != 1 || (!typeData->isError() && !typeData->isComplete())) { ++iter; + continue; + } + + const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit + = typeData->m_compiledData; + if (compilationUnit) { + if (compilationUnit->count() + > QQmlMetaType::countInternalCompositeTypeSelfReferences( + compilationUnit) + 1) { + ++iter; + continue; + } + + QQmlMetaType::unregisterInternalCompositeType(compilationUnit); + Q_ASSERT(compilationUnit->count() == 1); } + + // There are no live objects of this type + iter.value()->release(); + iter = m_typeCache.erase(iter); + deletedOneType = true; } if (!deletedOneType) |