aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloader.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-09-21 11:23:02 +0200
committerUlf Hermann <ulf.hermann@qt.io>2016-10-06 12:40:35 +0000
commit6c05fe9cb760a9a26d7a1a8037aa62966a3bd344 (patch)
tree58b6f36127be0a0ad77c800d952f803fcb4d0ea8 /src/qml/qml/qqmltypeloader.cpp
parent3b14e2ffdd8eb4b7f7f4508768b75f2acc399370 (diff)
QQmlTypeLoader: Clean up trimCache()
Any type that: a, has exactly one reference (from the type cache) b, has finished loading, and is thus either in Error or Complete state c, either has no compiled data or again exactly one reference on the compiled data (from the type) is not needed anymore and can be trimmed. The previous logic would not trim types with errors that have received compiled data by loading from a file and it was generally harder to understand. Change-Id: Ieb9ce29599411ea5516742b874cbcf3dcab03bde Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r--src/qml/qml/qqmltypeloader.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 20bd5d2620..87100d785e 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -1966,12 +1966,11 @@ void QQmlTypeLoader::trimCache()
for (TypeCache::Iterator iter = m_typeCache.begin(), end = m_typeCache.end(); iter != end; ++iter) {
QQmlTypeData *typeData = iter.value();
- const bool hasError = !typeData->m_compiledData && !typeData->m_errors.isEmpty();
- const bool isNotReferenced = typeData->isComplete() && typeData->m_compiledData
- && typeData->m_compiledData->count() == 1;
- // 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 && (hasError || isNotReferenced)) {
+ // 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
unneededTypes.append(iter);
}