diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-03-11 09:18:17 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-11 09:27:13 +0100 |
commit | 08d9ef715265d33f4cf04693b0787fd75994dc42 (patch) | |
tree | 191459fb83a6c8d2cf46bb8b25e3753393411dad /src | |
parent | 81993bab2cb1d37af4b9893ff10305920069b9e6 (diff) | |
download | qtscript-08d9ef715265d33f4cf04693b0787fd75994dc42.tar.gz |
Fix recursive calling of QScriptProgramv5.3.0-rc1v5.3.0-beta1v5.3.0release5.3.0
The first time a QScriptProgram is evaluated, it gets compiled and
then executed. If the execution would somehow trigger another
evaluation of the script program, it would run into the compile
stage again (even though it already was compiled), and then trigger
and assertion in debug mode (or leak memory in release builds).
Task-number: QTBUG-37317
Change-Id: I83e7efd5f238d021e200258826e2e4a9520c3a7d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h | 2 | ||||
-rw-r--r-- | src/script/api/qscriptengine.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h index d1d38de..53945e8 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h @@ -172,6 +172,8 @@ namespace JSC { JSObject* compile(ExecState*, ScopeChainNode*); + bool isCompiled() const { return m_evalCodeBlock; } + ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*); static PassRefPtr<EvalExecutable> create(ExecState* exec, const SourceCode& source) { return adoptRef(new EvalExecutable(exec, source)); } diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 6972ddb..aa5825f 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1366,7 +1366,7 @@ JSC::JSValue QScriptEnginePrivate::evaluateHelper(JSC::ExecState *exec, intptr_t q->clearExceptions(); JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject); - if (compile) { + if (compile && !executable->isCompiled()) { JSC::JSObject* error = executable->compile(exec, exec->scopeChain()); if (error) { compile = false; |