summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-05-18 05:40:53 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-05-18 05:46:07 (GMT)
commit9a111f72362b39be9b10d5d365faa21dfebf770e (patch)
tree648d262281ded09ca811e84fdc69d1dbd69a9fc8 /src
parent3d1a6596c6a381b71718af22eb8a861830ec7b6b (diff)
downloadQt-9a111f72362b39be9b10d5d365faa21dfebf770e.zip
Qt-9a111f72362b39be9b10d5d365faa21dfebf770e.tar.gz
Qt-9a111f72362b39be9b10d5d365faa21dfebf770e.tar.bz2
Prevent assignment of values (string, number, bool) to signal handlers.
Task-number: QTBUG-10764 Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index d880844..b5bf972 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -1316,6 +1316,9 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl
} else {
prop->values.at(0)->type = Value::SignalExpression;
+ if (!prop->values.at(0)->value.isScript())
+ COMPILE_EXCEPTION(prop, tr("Cannot assign a value to a signal (expecting a script to be run)"));
+
QString script = prop->values.at(0)->value.asScript().trimmed();
if (script.isEmpty())
COMPILE_EXCEPTION(prop, tr("Empty signal assignment"));