diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-02-18 14:24:45 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-02-18 14:40:10 +0000 |
commit | 06ec6340d0eff763e52135afabc13662b3892c43 (patch) | |
tree | 839663e808cb49633a35a453beb85f4b49801b96 /src/qml/compiler/qqmlpropertyvalidator.cpp | |
parent | 2131ec383b588e2160cb72247e61f7eab71cc0b1 (diff) |
Avoid unnecessary re-generation qml cache files in some circumstances
The map of name IDs to resolved types so far is copied several times
during compilation and different compile passes see different copies of it.
Compile passes may add things to the map, and if they do that on copies
that are inaccessible to other code, we get nondeterministic results.
Furthermore all the copies and pointers are confusing and inefficient.
Fixes: QTBUG-69340
Change-Id: I43ad3cbeeec34f90e05570eddc901fe8aa64c709
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qqmlpropertyvalidator.cpp')
-rw-r--r-- | src/qml/compiler/qqmlpropertyvalidator.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/qml/compiler/qqmlpropertyvalidator.cpp b/src/qml/compiler/qqmlpropertyvalidator.cpp index 25dcaa0c2d..414fea77b1 100644 --- a/src/qml/compiler/qqmlpropertyvalidator.cpp +++ b/src/qml/compiler/qqmlpropertyvalidator.cpp @@ -50,7 +50,6 @@ QQmlPropertyValidator::QQmlPropertyValidator(QQmlEnginePrivate *enginePrivate, c , compilationUnit(compilationUnit) , imports(imports) , qmlUnit(compilationUnit->unitData()) - , resolvedTypes(compilationUnit->resolvedTypes) , propertyCaches(compilationUnit->propertyCaches) , bindingPropertyDataPerObject(&compilationUnit->bindingPropertyDataPerObject) { @@ -96,7 +95,7 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex, return QVector<QQmlCompileError>(); QQmlCustomParser *customParser = nullptr; - if (auto typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex)) { + if (auto typeRef = resolvedType(obj->inheritedTypeNameIndex)) { if (typeRef->type.isValid()) customParser = typeRef->type.customParser(); } @@ -168,7 +167,7 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex, if (notInRevision) { QString typeName = stringAt(obj->inheritedTypeNameIndex); - auto *objectType = resolvedTypes.value(obj->inheritedTypeNameIndex); + auto *objectType = resolvedType(obj->inheritedTypeNameIndex); if (objectType && objectType->type.isValid()) { return recordError(binding->location, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(typeName).arg(name).arg(objectType->type.module()).arg(objectType->majorVersion).arg(objectType->minorVersion)); } else { @@ -633,7 +632,7 @@ QQmlCompileError QQmlPropertyValidator::validateObjectBinding(QQmlPropertyData * bool isPropertyInterceptor = false; const QV4::CompiledData::Object *targetObject = compilationUnit->objectAt(binding->value.objectIndex); - if (auto *typeRef = resolvedTypes.value(targetObject->inheritedTypeNameIndex)) { + if (auto *typeRef = resolvedType(targetObject->inheritedTypeNameIndex)) { QQmlRefPointer<QQmlPropertyCache> cache = typeRef->createPropertyCache(QQmlEnginePrivate::get(enginePrivate)); const QMetaObject *mo = cache->firstCppMetaObject(); QQmlType qmlType; |