diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2012-05-24 16:28:54 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-06 16:51:07 +0200 |
commit | a26d7aef3ce61ac0515cf8a324c8badd13bdb017 (patch) | |
tree | 1dd22962a7c40df451ae7f9465cf2ca4e4185cb7 /src/qml/qml/qqmlcompiler.cpp | |
parent | 1fcb3d512c37625e6dfdbd045c755e8d6aca8c57 (diff) |
Disallow parent changes for QML created objects
Currently this is protected with a QML_PARENT_TEST environment variable
to allow the rest of QtQuick to be updated before it is enforced.
Change-Id: I4dd3644cbbce91d67f24c9556637f97eafb00638
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlcompiler.cpp')
-rw-r--r-- | src/qml/qml/qqmlcompiler.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index f8625861af..218d719634 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -1155,7 +1155,7 @@ bool QQmlCompiler::buildObject(QQmlScript::Object *obj, const BindingContext &ct return true; } -void QQmlCompiler::genObject(QQmlScript::Object *obj) +void QQmlCompiler::genObject(QQmlScript::Object *obj, bool parentToSuper) { QQmlCompiledData::TypeReference &tr = output->types[obj->type]; if (tr.type && obj->metatype->metaObject() == &QQmlComponent::staticMetaObject) { @@ -1173,6 +1173,7 @@ void QQmlCompiler::genObject(QQmlScript::Object *obj) create.type = obj->type; create.line = obj->location.start.line; create.column = obj->location.start.column; + create.parentToSuper = parentToSuper; output->addInstruction(create); } else { @@ -1186,6 +1187,7 @@ void QQmlCompiler::genObject(QQmlScript::Object *obj) create.data = output->indexForByteArray(obj->custom); create.type = obj->type; create.isRoot = (compileState->root == obj); + create.parentToSuper = parentToSuper; output->addInstruction(create); } else { Instruction::CreateQMLObject create; @@ -1975,31 +1977,25 @@ void QQmlCompiler::genPropertyAssignment(QQmlScript::Property *prop, v->type == Value::ValueInterceptor); if (v->type == Value::ValueSource) { - genObject(v->object); + genObject(v->object, valueTypeProperty?true:false); Instruction::StoreValueSource store; - if (valueTypeProperty) { + if (valueTypeProperty) store.property = genValueTypeData(prop, valueTypeProperty); - store.owner = 1; - } else { + else store.property = prop->core; - store.owner = 0; - } QQmlType *valueType = toQmlType(v->object); store.castValue = valueType->propertyValueSourceCast(); output->addInstruction(store); } else if (v->type == Value::ValueInterceptor) { - genObject(v->object); + genObject(v->object, valueTypeProperty?true:false); Instruction::StoreValueInterceptor store; - if (valueTypeProperty) { + if (valueTypeProperty) store.property = genValueTypeData(prop, valueTypeProperty); - store.owner = 1; - } else { + else store.property = prop->core; - store.owner = 0; - } QQmlType *valueType = toQmlType(v->object); store.castValue = valueType->propertyValueInterceptorCast(); output->addInstruction(store); |