From 5a9fd4f49ec48c91c70699fc40af8f843c51b4ab Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 28 Feb 2017 15:55:39 +0100 Subject: V4 Debugger: Don't crash when stepping to the end of a script The last instruction is a return, which leads to an invalid context. Don't try to save that context, but rather clear the current one. Change-Id: I468b7420c4ca0842209c9b00478f99cc4dc69726 Reviewed-by: Simon Hausmann --- src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/plugins/qmltooling') diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp index 5cc2043cb1..75cbc9eba1 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp @@ -230,7 +230,12 @@ void QV4Debugger::leavingFunction(const QV4::ReturnedValue &retVal) QMutexLocker locker(&m_lock); if (m_stepping != NotStepping && m_currentContext.asManaged()->d() == m_engine->current) { - m_currentContext.set(m_engine, *m_engine->parentContext(m_engine->currentContext)); + if (QV4::ExecutionContext *parentContext + = m_engine->parentContext(m_engine->currentContext)) { + m_currentContext.set(m_engine, *parentContext); + } else { + m_currentContext.clear(); + } m_stepping = StepOver; m_returnedValue.set(m_engine, retVal); } -- cgit v1.2.3