aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling/qmldbg_nativedebugger
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_nativedebugger
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_nativedebugger')
-rw-r--r--src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp
index 7bf419a1d9..e8570a380f 100644
--- a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp
@@ -252,7 +252,10 @@ QV4::ReturnedValue NativeDebugger::evaluateExpression(const QString &expression)
QV4::ExecutionContext *ctx = m_engine->currentContext();
QV4::Script script(ctx, QV4::Compiler::EvalCode, expression);
- script.strictMode = ctx->d()->v4Function->isStrict();
+ if (QV4::Function *function = m_engine->currentStackFrame->v4Function)
+ script.strictMode = function->isStrict();
+ else if (m_engine->globalCode)
+ script.strictMode = m_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;