From acd206e317fd92f20aa4985f35288f793d05f3ac Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 15 Sep 2017 10:14:58 +0200 Subject: Fix CallData setup for Script::run By calling JSCall with an ExecutionContext as first parameter, the compiler would implicitly create a temporary Scope object in order to be able to do the call. However, the scope would then wipe the stack when it is being destructed. So subsequently retrieving argc would always result in 0 arguments. To prevent accidents like this, all Scope constructors are now explicit, and the QV4::Script's ExecutionContext is renamed from scope to context. Change-Id: Iea7930748a0544382a20b6617fa9818a8a2bea7f Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4script_p.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/qml/jsruntime/qv4script_p.h') diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h index 8d7500eb13..f3a4853fa3 100644 --- a/src/qml/jsruntime/qv4script_p.h +++ b/src/qml/jsruntime/qv4script_p.h @@ -91,11 +91,11 @@ struct ContextStateSaver { struct Q_QML_EXPORT Script { Script(ExecutionContext *scope, QV4::Compiler::CompilationMode mode, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0) : sourceFile(source), line(line), column(column), sourceCode(sourceCode) - , scope(scope), strictMode(false), inheritContext(false), parsed(false), compilationMode(mode) + , context(scope), strictMode(false), inheritContext(false), parsed(false), compilationMode(mode) , vmFunction(0), parseAsBinding(false) {} Script(ExecutionEngine *engine, QmlContext *qml, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0) : sourceFile(source), line(line), column(column), sourceCode(sourceCode) - , scope(engine->rootContext()), strictMode(false), inheritContext(true), parsed(false) + , context(engine->rootContext()), strictMode(false), inheritContext(true), parsed(false) , vmFunction(0), parseAsBinding(true) { if (qml) qmlContext.set(engine, *qml); @@ -106,7 +106,7 @@ struct Q_QML_EXPORT Script { int line; int column; QString sourceCode; - ExecutionContext *scope; + ExecutionContext *context; bool strictMode; bool inheritContext; bool parsed; -- cgit v1.2.3