From 08d9ef715265d33f4cf04693b0787fd75994dc42 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 11 Mar 2014 09:18:17 +0100 Subject: Fix recursive calling of QScriptProgram 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 --- src/script/api/qscriptengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/script/api') 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; -- cgit v1.2.1