aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2019-09-24 08:51:52 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2019-09-25 08:10:50 +0200
commitcbd6273833c5910c77748c15a8ac83cc5080bd71 (patch)
tree88df74e9d21b939ae46f505822df6c9c59f6e9e9 /src/qml/qml
parentf423459ac1bb0b05ef87e6cfc314ff21acef5b5f (diff)
required properties: move hadRequiredProperties to shared state
If hadRequiredProperties is a property of a specific object creator instance, we lose the information until the required property gets noticed in the toplevel creator. By storing it in sharedState, hadRequiredProperties will always be set in case we encountered a required property. Change-Id: I226604175febe36406ca4eae57cab2a3a6be9777 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp4
-rw-r--r--src/qml/qml/qqmlobjectcreator_p.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index d2e9d36d55..dfcab6181d 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -82,7 +82,6 @@ QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, const QQmlR
, propertyCaches(&compilationUnit->propertyCaches)
, sharedState(new QQmlObjectCreatorSharedState)
, topLevelCreator(true)
- , hadRequiredProperties(false)
, incubator(incubator)
{
init(parentContext);
@@ -94,6 +93,7 @@ QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, const QQmlR
sharedState->allJavaScriptObjects = nullptr;
sharedState->creationContext = creationContext;
sharedState->rootContext = nullptr;
+ sharedState->hadRequiredProperties = false;
if (auto profiler = QQmlEnginePrivate::get(engine)->profiler) {
Q_QML_PROFILE_IF_ENABLED(QQmlProfilerDefinitions::ProfileCreating, profiler,
@@ -1524,7 +1524,7 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject *
const QV4::CompiledData::Property* property = _compiledObject->propertiesBegin() + propertyIndex;
QQmlPropertyData *propertyData = _propertyCache->property(_propertyCache->propertyOffset() + propertyIndex);
if (property->isRequired) {
- hadRequiredProperties = true;
+ sharedState->hadRequiredProperties = true;
sharedState->requiredProperties.insert(propertyData,
RequiredPropertyInfo {compilationUnit->stringAt(property->nameIndex), compilationUnit->finalUrl(), property->location, {}});
}
diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h
index c302660799..59e236c855 100644
--- a/src/qml/qml/qqmlobjectcreator_p.h
+++ b/src/qml/qml/qqmlobjectcreator_p.h
@@ -101,6 +101,7 @@ struct QQmlObjectCreatorSharedState : public QSharedData
QQmlVmeProfiler profiler;
QRecursionNode recursionNode;
RequiredProperties requiredProperties;
+ bool hadRequiredProperties;
};
class Q_QML_PRIVATE_EXPORT QQmlObjectCreator
@@ -126,7 +127,7 @@ public:
QFiniteStack<QPointer<QObject> > &allCreatedObjects() { return sharedState->allCreatedObjects; }
RequiredProperties &requiredProperties() {return sharedState->requiredProperties;}
- bool componentHadRequiredProperties() const {return hadRequiredProperties;}
+ bool componentHadRequiredProperties() const {return sharedState->hadRequiredProperties;}
private:
QQmlObjectCreator(QQmlContextData *contextData, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, QQmlObjectCreatorSharedState *inheritedSharedState);
@@ -173,7 +174,6 @@ private:
const QQmlPropertyCacheVector *propertyCaches;
QExplicitlySharedDataPointer<QQmlObjectCreatorSharedState> sharedState;
bool topLevelCreator;
- bool hadRequiredProperties;
QQmlIncubatorPrivate *incubator;
QObject *_qobject;