aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling/qmldbg_debugger
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-10-26 10:52:19 +0200
committerUlf Hermann <ulf.hermann@qt.io>2017-11-07 09:19:40 +0000
commit425edd90acfbb81b50f63db7f60927dcae197dfd (patch)
tree012c991cf2e5f68ccd0c04b2ef6f2f0a8705355e /src/plugins/qmltooling/qmldbg_debugger
parent3f37847fc3758d66cb16e8e070c29ac5b39dbc7a (diff)
V4 Debugger: Allow executing jobs on contexts without v4Function
Previously this would crash as it tried to determine strict mode by querying the function. Check the functions of out contexts, too, and finally try the global context if none is found. Change-Id: Ib21c2f4f242a67909944b71640a154ff181c33e1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_debugger')
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
index e852f574a7..8b51574525 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
@@ -67,11 +67,11 @@ void JavaScriptJob::run()
QV4::ScopedContext ctx(scope, engine->currentContext());
QObject scopeObject;
+ QV4::CppStackFrame *frame = engine->currentStackFrame;
if (frameNr > 0) {
- QV4::CppStackFrame *f = engine->currentStackFrame;
for (int i = 0; i < frameNr; ++i)
- f = f->parent;
- ctx = static_cast<QV4::ExecutionContext *>(&f->jsFrame->context);
+ frame = frame->parent;
+ ctx = static_cast<QV4::ExecutionContext *>(&frame->jsFrame->context);
}
if (context >= 0) {
@@ -103,7 +103,10 @@ void JavaScriptJob::run()
}
QV4::Script script(ctx, QV4::Compiler::EvalCode, this->script);
- script.strictMode = ctx->d()->v4Function->isStrict();
+ if (QV4::Function *function = frame->v4Function)
+ script.strictMode = function->isStrict();
+ else if (engine->globalCode)
+ script.strictMode = engine->globalCode->isStrict();
// In order for property lookups in QML to work, we need to disable fast v4 lookups. That
// is a side-effect of inheritContext.
script.inheritContext = true;