diff options
author | Lars Knoll <lars.knoll@qt.io> | 2016-12-02 15:19:45 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2016-12-09 14:01:49 +0000 |
commit | c953f8b550b7ea9e7989f9fddaaa14324354aea3 (patch) | |
tree | 02ec1179f225e7b8080136e9e9afc8d6da7fcc32 /src/qml/qml/qqmlobjectcreator.cpp | |
parent | 421d21a0334002f6497ce105876856dc0647c8ff (diff) |
Avoid the creation of a FunctionObject for most bindings
Change-Id: Ia62d380945250015009d9c2b6ed65f6d830277ef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index ba3c6600b8..be6a197414 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -792,10 +792,10 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *property, con QV4::Function *runtimeFunction = compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex]; QV4::Scope scope(v4); - QV4::ScopedContext qmlContext(scope, currentQmlContext()); - QV4::ScopedFunctionObject function(scope, QV4::FunctionObject::createScriptFunction(qmlContext, runtimeFunction, /*createProto*/ false)); + QV4::Scoped<QV4::QmlContext> qmlContext(scope, currentQmlContext()); if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerExpression) { + QV4::ScopedFunctionObject function(scope, QV4::FunctionObject::createScriptFunction(qmlContext, runtimeFunction, /*createProto*/ false)); int signalIndex = _propertyCache->methodIndexToSignalIndex(property->coreIndex()); QQmlBoundSignal *bs = new QQmlBoundSignal(_bindingTarget, signalIndex, _scopeObject, engine); QQmlBoundSignalExpression *expr = new QQmlBoundSignalExpression(_bindingTarget, signalIndex, @@ -815,7 +815,7 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *property, con prop = _valueTypeProperty; subprop = property; } - qmlBinding = QQmlBinding::create(prop, function, _scopeObject, context); + qmlBinding = QQmlBinding::create(prop, runtimeFunction, _scopeObject, context, qmlContext); qmlBinding->setTarget(_bindingTarget, *prop, subprop); sharedState->allCreatedBindings.push(QQmlAbstractBinding::Ptr(qmlBinding)); |