summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcompiler.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-12-10 23:07:49 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-12-10 23:09:02 (GMT)
commitcf01cfb8275c785d21eb5867c968cac1f54d296e (patch)
treedaae21a78efe2a5affa4ba2e00d36c833f931bce /src/declarative/qml/qmlcompiler.cpp
parent7b45f8dd55bc1b02f20913cf77441fb1069603b1 (diff)
downloadQt-cf01cfb8275c785d21eb5867c968cac1f54d296e.zip
Qt-cf01cfb8275c785d21eb5867c968cac1f54d296e.tar.gz
Qt-cf01cfb8275c785d21eb5867c968cac1f54d296e.tar.bz2
Generate error when attempting to write to a read-only object property.
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index 108e3cc..f9a9b1b 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -1933,6 +1933,9 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
Q_ASSERT(prop->index != -1);
Q_ASSERT(v->object->type != -1);
+ if (!obj->metaObject()->property(prop->index).isWritable())
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name)));
+
if (QmlMetaType::isInterface(prop->type)) {
// Assigning an object to an interface ptr property