diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-08-20 16:12:45 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-09-08 18:34:23 +0000 |
commit | 761f23acbedf66a02d91d9e4da232ee28b65aeee (patch) | |
tree | 325140a312bccd9f03e165cc57e3f055e95db752 /src/qml/jsruntime/qv4script.cpp | |
parent | 0c48277203b13ebc37fba4f4d111db7e6b7579a8 (diff) |
Pass the correct QML context as scope to the binding wrapper
Change-Id: Ib98b9bea1e021fb99f7f82c211111988939515b0
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4script.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4script.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 493e35c852..41cb6309f8 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -65,7 +65,7 @@ struct CompilationUnitHolder : Object { }; struct QmlBindingWrapper : FunctionObject { - QmlBindingWrapper(QV4::ExecutionContext *scope, Function *f, QV4::QmlContextWrapper *qml); + QmlBindingWrapper(QV4::QmlContext *scope, Function *f); }; } @@ -98,7 +98,7 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(QmlBindingWrapper); DEFINE_OBJECT_VTABLE(CompilationUnitHolder); -Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::ExecutionContext *scope, Function *f, QV4::QmlContextWrapper *qml) +Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::QmlContext *scope, Function *f) : Heap::FunctionObject(scope, scope->d()->engine->id_eval(), /*createProto = */ false) { Q_ASSERT(scope->inUse()); @@ -106,11 +106,6 @@ Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::ExecutionContext *scope, Functio function = f; if (function) function->compilationUnit->addref(); - - Scope s(scope); - Scoped<QV4::QmlBindingWrapper> protectThis(s, this); - - this->scope = scope->newQmlContext(qml); } ReturnedValue QmlBindingWrapper::call(const Managed *that, CallData *callData) @@ -248,7 +243,8 @@ ReturnedValue Script::run() return Q_V4_PROFILE(engine, vmFunction); } else { Scoped<QmlContextWrapper> qmlObj(valueScope, qml.value()); - ScopedFunctionObject f(valueScope, engine->memoryManager->alloc<QmlBindingWrapper>(scope, vmFunction, qmlObj)); + Scoped<QmlContext> qmlContext(valueScope, scope->newQmlContext(qmlObj)); + ScopedFunctionObject f(valueScope, engine->memoryManager->alloc<QmlBindingWrapper>(qmlContext, vmFunction)); ScopedCallData callData(valueScope); callData->thisObject = Primitive::undefinedValue(); return f->call(callData); @@ -326,7 +322,8 @@ ReturnedValue Script::qmlBinding() ExecutionEngine *v4 = scope->engine(); Scope valueScope(v4); Scoped<QmlContextWrapper> qmlObj(valueScope, qml.value()); - ScopedObject v(valueScope, v4->memoryManager->alloc<QmlBindingWrapper>(scope, vmFunction, qmlObj)); + Scoped<QmlContext> qmlContext(valueScope, scope->newQmlContext(qmlObj)); + ScopedObject v(valueScope, v4->memoryManager->alloc<QmlBindingWrapper>(qmlContext, vmFunction)); return v.asReturnedValue(); } |