aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index c3d7a65a32..822184042c 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -123,7 +123,7 @@ Heap::FunctionObject::FunctionObject(ExecutionContext *scope, const ReturnedValu
Heap::FunctionObject::FunctionObject(InternalClass *ic, QV4::Object *prototype)
: Heap::Object(ic, prototype)
- , scope(ic->engine->rootContext()->d())
+ , scope(ic->engine->rootContext())
{
Scope scope(ic->engine);
ScopedObject o(scope, this);
@@ -258,7 +258,8 @@ ReturnedValue FunctionCtor::construct(Managed *that, CallData *callData)
QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit = isel->compile();
QV4::Function *vmf = compilationUnit->linkToEngine(v4);
- return FunctionObject::createScriptFunction(v4->rootContext(), vmf)->asReturnedValue();
+ ScopedContext global(scope, scope.engine->rootContext());
+ return FunctionObject::createScriptFunction(global, vmf)->asReturnedValue();
}
// 15.3.1: This is equivalent to new Function(...)
@@ -373,7 +374,8 @@ ReturnedValue FunctionPrototype::method_bind(CallContext *ctx)
memcpy(boundArgs->data(), ctx->d()->callData->args + 1, (ctx->d()->callData->argc - 1)*sizeof(Value));
}
- return BoundFunction::create(ctx->d()->engine->rootContext(), target, boundThis, boundArgs)->asReturnedValue();
+ ScopedContext global(scope, scope.engine->rootContext());
+ return BoundFunction::create(global, target, boundThis, boundArgs)->asReturnedValue();
}
DEFINE_OBJECT_VTABLE(ScriptFunction);