aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlboundsignal.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-23 15:52:10 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-26 09:05:16 +0200
commit12fd2ccd3fa2dc0133b5a3fb89f9fdf5cf721232 (patch)
tree880acb9c7c0d8289185b6aebe4339f439c707a0e /src/qml/qml/qqmlboundsignal.cpp
parent2e4f66caa8a5f9e887dbdb4e3f2ae5c9be9a7005 (diff)
Fix Persistent/WeakValue API
Don't use unprotected Values in the API anymore. Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlboundsignal.cpp')
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index 3a0d58d87c..cc2edb7b19 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -86,7 +86,7 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index,
m_expression = expression;
}
-QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scope, const QV4::PersistentValue &function)
+QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scope, const QV4::ValueRef &function)
: QQmlJavaScriptExpression(&QQmlBoundSignalExpression_jsvtable),
m_v8function(function),
m_line(-1),
@@ -128,7 +128,9 @@ QString QQmlBoundSignalExpression::expression() const
{
if (m_expressionFunctionValid) {
Q_ASSERT (context() && engine());
- return m_v8function.value().toQStringNoThrow();
+ QV4::Scope scope(QQmlEnginePrivate::get(engine())->v4engine());
+ QV4::ScopedValue v(scope, m_v8function.value());
+ return v->toQStringNoThrow();
} else {
return m_expression;
}
@@ -144,6 +146,7 @@ void QQmlBoundSignalExpression::evaluate(void **a)
return;
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine());
+ QV4::Scope scope(ep->v4engine());
ep->referenceScarceResources(); // "hold" scarce resources in memory during evaluation.
{
@@ -181,7 +184,7 @@ void QQmlBoundSignalExpression::evaluate(void **a)
m_v8function = evalFunction(context(), scopeObject(), expression,
m_fileName, m_line, &m_v8qmlscope);
- if (m_v8function.isUndefined() || m_v8function.value().isNull()) {
+ if (m_v8function.isNullOrUndefined()) {
ep->dereferenceScarceResources();
return; // could not evaluate function. Not valid.
}
@@ -223,7 +226,8 @@ void QQmlBoundSignalExpression::evaluate(void **a)
}
}
- QQmlJavaScriptExpression::evaluate(context(), m_v8function.value(), argCount, args, 0);
+ QV4::ScopedValue f(scope, m_v8function.value());
+ QQmlJavaScriptExpression::evaluate(context(), f, argCount, args, 0);
}
ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete.
}