aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlexpression.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-13 09:01:29 +0100
committerLars Knoll <lars.knoll@digia.com>2015-01-13 22:42:04 +0100
commit39f1e0d66dc434e764731fbfed29c8fd98d217aa (patch)
treed9855dbedd752c23395ccb6d4d3dc8fc3bece254 /src/qml/qml/qqmlexpression.cpp
parenta38f9ec6c96559efa56e8f7346f74f5990810c3a (diff)
Make sure we always have an engine when assigning to a Persistent
This prepares things for a rewrite of the internals of Persistent. Change-Id: Ib93ec5911984d1bfce87ffdc3f86bc75f6ecafe9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlexpression.cpp')
-rw-r--r--src/qml/qml/qqmlexpression.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp
index 1e31a8f638..ba561ad8e5 100644
--- a/src/qml/qml/qqmlexpression.cpp
+++ b/src/qml/qml/qqmlexpression.cpp
@@ -73,7 +73,8 @@ void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr, QOb
void QQmlExpressionPrivate::init(QQmlContextData *ctxt, QV4::Function *runtimeFunction, QObject *me)
{
expressionFunctionValid = true;
- function = QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxt, me, runtimeFunction);
+ QV4::ExecutionEngine *engine = QQmlEnginePrivate::getV4Engine(ctxt->engine);
+ function.set(engine, QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxt, me, runtimeFunction));
QQmlAbstractExpression::setContext(ctxt);
setScopeObject(me);
@@ -247,12 +248,13 @@ QV4::ReturnedValue QQmlExpressionPrivate::v4value(bool *isUndefined)
{
Q_Q(QQmlExpression);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(q->engine())->v4engine();
+
if (!expressionFunctionValid) {
- function = qmlBinding(context(), scopeObject(), expression, url, line, &qmlscope);
+ function.set(v4, qmlBinding(context(), scopeObject(), expression, url, line, &qmlscope));
expressionFunctionValid = true;
}
- QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(q->engine())->v4engine();
QV4::Scope scope(v4);
QV4::ScopedValue f(scope, function.value());
return evaluate(context(), f, isUndefined);