summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcompiler.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-16 07:08:50 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-16 07:08:50 (GMT)
commitd71ef06fc1261968b8c5ecf7a438db02e2654b29 (patch)
treef530a2b311bea40e13fdfe2bb2da0ccb4aa72b65 /src/declarative/qml/qmlcompiler.cpp
parentd080c1c2ded0d59974f86f9f3dac91b099bda0a9 (diff)
downloadQt-d71ef06fc1261968b8c5ecf7a438db02e2654b29.zip
Qt-d71ef06fc1261968b8c5ecf7a438db02e2654b29.tar.gz
Qt-d71ef06fc1261968b8c5ecf7a438db02e2654b29.tar.bz2
Protect against overriding FINAL properties
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index 182495a..b0bc6e8 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -160,8 +160,8 @@ bool QmlCompiler::isSignalPropertyName(const QByteArray &name)
QString exceptionDescription; \
QmlError error; \
error.setUrl(output->url); \
- error.setLine(token->location.start.line); \
- error.setColumn(token->location.start.column); \
+ error.setLine((token)->location.start.line); \
+ error.setColumn((token)->location.start.column); \
QDebug d(&exceptionDescription); \
d << desc; \
error.setDescription(exceptionDescription.trimmed()); \
@@ -1738,6 +1738,14 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
for (int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
const Object::DynamicProperty &p = obj->dynamicProperties.at(ii);
+ int propIdx =
+ obj->metaObject()->indexOfProperty(p.name.constData());
+ if (-1 != propIdx) {
+ QMetaProperty prop = obj->metaObject()->property(propIdx);
+ if (prop.isFinal())
+ COMPILE_EXCEPTION(&p, "Cannot override FINAL property");
+ }
+
if (p.isDefaultProperty &&
(p.type != Object::DynamicProperty::Alias ||
mode == ResolveAliases))