aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2012-05-21 09:27:43 +1000
committerQt by Nokia <qt-info@nokia.com>2012-08-24 00:55:55 +0200
commit0853343c33e394f35c31c161b019b2aed17f9256 (patch)
tree3f792f58979ae75f8e75a0c0ef6e7f89265b1c16 /src/quick/util
parent9ee6bb0e14d968647350683eafbe80eed7a27058 (diff)
Avoid dynamic lookup of signal handler arguments
Rewrite signal handlers to include the parameters in the rewrite. Also check whether parameters are actually used when possible, and if not don't provide them to the expression. Change-Id: I7d65c05f4639979dd61035cf7478119ef7647c25 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src/quick/util')
-rw-r--r--src/quick/util/qquickconnections.cpp7
-rw-r--r--src/quick/util/qquickpropertychanges.cpp4
2 files changed, 8 insertions, 3 deletions
diff --git a/src/quick/util/qquickconnections.cpp b/src/quick/util/qquickconnections.cpp
index d2591557d1..98fc270e13 100644
--- a/src/quick/util/qquickconnections.cpp
+++ b/src/quick/util/qquickconnections.cpp
@@ -279,8 +279,9 @@ void QQuickConnections::connectSignals()
QQmlProperty prop(target(), propName);
if (prop.isValid() && (prop.type() & QQmlProperty::SignalProperty)) {
+ int signalIndex = QQmlPropertyPrivate::get(prop)->signalIndex();
QQmlBoundSignal *signal =
- new QQmlBoundSignal(target(), QQmlPropertyPrivate::get(prop)->signalIndex(), this, qmlEngine(this));
+ new QQmlBoundSignal(target(), signalIndex, this, qmlEngine(this));
QString location;
QQmlContextData *ctxtdata = 0;
@@ -292,7 +293,9 @@ void QQuickConnections::connectSignals()
}
QQmlBoundSignalExpression *expression = ctxtdata ?
- new QQmlBoundSignalExpression(ctxtdata, 0, script, true, location, line, column) : 0;
+ new QQmlBoundSignalExpression(target(), signalIndex,
+ ctxtdata, this, script,
+ true, location, line, column) : 0;
signal->takeExpression(expression);
d->boundsignals += signal;
} else {
diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp
index 48c00f1d51..ead1cd7c0d 100644
--- a/src/quick/util/qquickpropertychanges.cpp
+++ b/src/quick/util/qquickpropertychanges.cpp
@@ -342,7 +342,9 @@ void QQuickPropertyChangesPrivate::decode()
QQuickReplaceSignalHandler *handler = new QQuickReplaceSignalHandler;
handler->property = prop;
- handler->expression.take(new QQmlBoundSignalExpression(QQmlContextData::get(qmlContext(q)), object, expression, false, url.toString(), line, column));
+ handler->expression.take(new QQmlBoundSignalExpression(object, QQmlPropertyPrivate::get(prop)->signalIndex(),
+ QQmlContextData::get(qmlContext(q)), object, expression,
+ false, url.toString(), line, column));
signalReplacements << handler;
} else if (isScript) { // binding
QString expression = data.toString();