diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-09-15 10:14:58 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-09-15 10:41:08 +0000 |
commit | acd206e317fd92f20aa4985f35288f793d05f3ac (patch) | |
tree | 0169ec7fb4adf7300c4e47f2a5372aa0b76b41a9 /src/qml/jsruntime/qv4scopedvalue_p.h | |
parent | dfb3ba6329147f0d0ea22d62b9903246ce2934bd (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/qv4scopedvalue_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4scopedvalue_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h index 575f4e6e3f..afb5c21d36 100644 --- a/src/qml/jsruntime/qv4scopedvalue_p.h +++ b/src/qml/jsruntime/qv4scopedvalue_p.h @@ -87,7 +87,7 @@ struct ScopedValue; return scope.engine->throwError(QString::fromUtf8(str)) struct Scope { - inline Scope(ExecutionContext *ctx) + explicit Scope(ExecutionContext *ctx) : engine(ctx->engine()) , mark(engine->jsStackTop) { @@ -99,7 +99,7 @@ struct Scope { { } - inline Scope(const Managed *m) + explicit Scope(const Managed *m) : engine(m->engine()) , mark(engine->jsStackTop) { |