From c14c382e6e8527be1129788ccca31309b032f99c Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 26 Aug 2016 12:57:58 -0500 Subject: Allow for garbage collection of types with errors in trimCache() Change-Id: I821ea14f60871735bface4e2cf4e61fcb61b2784 Task-number: QTBUG-55567 Reviewed-by: Michael Brasser Reviewed-by: Ulf Hermann --- src/qml/qml/qqmltypeloader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 01200fd881..6480420212 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -1961,8 +1961,10 @@ void QQmlTypeLoader::trimCache() QList unneededTypes; for (TypeCache::Iterator iter = m_typeCache.begin(), end = m_typeCache.end(); iter != end; ++iter) { QQmlTypeData *typeData = iter.value(); - if (typeData->m_compiledData && typeData->count() == 1 - && typeData->m_compiledData->count() == 1) { + + const bool hasError = !typeData->m_compiledData && !typeData->m_errors.isEmpty(); + const bool isNotReferenced = typeData->m_compiledData && typeData->m_compiledData->count() == 1; + if (typeData->count() == 1 && (hasError || isNotReferenced)) { // There are no live objects of this type unneededTypes.append(iter); } -- cgit v1.2.3