summaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4script_p.h
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2017-09-15 10:14:58 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2017-09-15 10:41:08 +0000
commitacd206e317fd92f20aa4985f35288f793d05f3ac (patch)
tree0169ec7fb4adf7300c4e47f2a5372aa0b76b41a9 /src/qml/jsruntime/qv4script_p.h
parentdfb3ba6329147f0d0ea22d62b9903246ce2934bd (diff)
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 <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4script_p.h')
-rw-r--r--src/qml/jsruntime/qv4script_p.h6
1 files changed, 3 insertions, 3 deletions
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;