diff options
author | Lars Knoll <lars.knoll@qt.io> | 2016-12-02 14:23:04 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2016-12-09 14:01:42 +0000 |
commit | 1eee98f1c1c59f8c45387684e269629713958bd4 (patch) | |
tree | 786e909d5427e07c08d9a7263d005723cf95c737 /src/qml/qml/qqmlboundsignal.cpp | |
parent | f1dca03794f8db353655d44e742a2960f1f69070 (diff) |
Limit access to m_function to QQmlJavaScriptExpression
Change-Id: I070f73f106440667fce2c7fe33310369a6aa1376
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlboundsignal.cpp')
-rw-r--r-- | src/qml/qml/qqmlboundsignal.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 91b3f89825..974bd3404a 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -98,7 +98,9 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, function += parameterString; function += QLatin1String(") { ") + expression + QLatin1String(" })"); - m_function.set(v4, evalFunction(context(), scopeObject(), function, fileName, line)); + QV4::Scope valueScope(v4); + QV4::ScopedFunctionObject f(valueScope, evalFunction(context(), scopeObject(), function, fileName, line)); + setFunctionObject(f); } QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scope, const QV4::Value &function) @@ -106,7 +108,7 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, m_index(index), m_target(target) { - m_function.set(function.as<QV4::Object>()->engine(), function); + setFunctionObject(function.as<QV4::FunctionObject>()); init(ctxt, scope); } @@ -121,7 +123,9 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QMetaMethod signal = QMetaObjectPrivate::signal(m_target->metaObject(), m_index); QString error; QV4::ExecutionEngine *engine = QQmlEnginePrivate::getV4Engine(ctxt->engine); - m_function.set(engine, QV4::FunctionObject::createQmlFunction(ctxt, scope, runtimeFunction, signal.parameterNames(), &error)); + QV4::Scope valueScope(engine); + QV4::ScopedFunctionObject f(valueScope, QV4::FunctionObject::createQmlFunction(ctxt, scope, runtimeFunction, signal.parameterNames(), &error)); + setFunctionObject(f); if (!error.isEmpty()) qmlInfo(scopeObject()) << error; } |