diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-08-24 16:16:56 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-09-15 07:37:22 +0000 |
commit | 0e6195a85c5b9beceac719a7ea0c1389667bfcb3 (patch) | |
tree | abb6e1cfbb31142cd5aaa4b8e1a43cd61dc35548 /src/qml/jsapi/qjsengine.cpp | |
parent | df7710a2052a205267854f611e12e120b2dfdc26 (diff) |
Cleanup usage of ExecutionEngine::currentContext
Change-Id: Ic79d6da162375928ec25871cd0341daeab6483d2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsapi/qjsengine.cpp')
-rw-r--r-- | src/qml/jsapi/qjsengine.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp index 402dbd321f..3ca05b90c1 100644 --- a/src/qml/jsapi/qjsengine.cpp +++ b/src/qml/jsapi/qjsengine.cpp @@ -317,7 +317,9 @@ QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, in { QV4::ExecutionEngine *v4 = d->m_v4Engine; QV4::Scope scope(v4); - QV4::ScopedContext ctx(scope, v4->currentContext()); + QV4::ExecutionContextSaver saver(scope); + + QV4::ExecutionContext *ctx = v4->currentExecutionContext; if (ctx->d() != v4->rootContext()->d()) ctx = v4->pushGlobalContext(); QV4::ScopedValue result(scope); @@ -330,8 +332,7 @@ QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, in result = script.run(); if (scope.engine->hasException) result = v4->catchException(); - if (ctx->d() != v4->rootContext()->d()) - v4->popContext(); + return QJSValue(v4, result->asReturnedValue()); } |