diff options
author | Lars Knoll <[email protected]> | 2013-11-22 08:32:37 +0100 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-12-04 09:45:43 +0100 |
commit | 5e8bee55aa78551c2d31b24228227c0bbbdc1d8d (patch) | |
tree | 8b9a5805b0f905607672820536821eabd459cb75 /src/qml/jsruntime | |
parent | 81d55c6ef3b8faf6ca7bfcc7f9e212e382c2689f (diff) |
Fix a bug in the code for eval
When eval was being used as an indirect call, the code
didn't reset the current context properly before
returning from the eval call.
Change-Id: Id5c7e9a897101d25593ef0f3b9945adaf19360b3
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4globalobject.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 82622de5bb..33a97554ca 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -379,15 +379,17 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall) if (callData->argc < 1) return Encode::undefined(); - ExecutionContext *parentContext = engine()->current; - ExecutionEngine *engine = parentContext->engine; + ExecutionEngine *v4 = engine(); + ExecutionContext *parentContext = v4->current; + ExecutionContextSaver ctxSaver(parentContext); + ExecutionContext *ctx = parentContext; Scope scope(ctx); if (!directCall) { // the context for eval should be the global scope, so we fake a root // context - ctx = engine->pushGlobalContext(); + ctx = v4->pushGlobalContext(); } if (!callData->args[0].isString()) @@ -418,7 +420,6 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall) return e->call(callData); } - ExecutionContextSaver ctxSaver(parentContext); ContextStateSaver stateSaver(ctx); ExecutionContext::EvalCode evalCode; @@ -437,7 +438,6 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall) ReturnedValue EvalFunction::call(Managed *that, CallData *callData) { // indirect call - // ### const_cast return static_cast<EvalFunction *>(that)->evalCall(callData, false); } |