From 38d2baa2ddd3dbf2969ef7b17f6a6adccc15aefa Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 16 Jul 2015 16:14:43 +0200 Subject: [PATCH] Debugger: Ask JS debug server to evaluate(something) only when stopped The server on the Qt side Q_ASSERTs otherwise, killing the application. Change-Id: I273f12c4bc89bd3488fa6409fdbebc6a6ac2b606 Reviewed-by: Christian Stenger Reviewed-by: hjk --- src/plugins/debugger/qml/qmlengine.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index d10984c41ae..735840fee12 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -995,10 +995,14 @@ void QmlEngine::updateItem(const QByteArray &iname) const WatchItem *item = watchHandler()->findItem(iname); QTC_ASSERT(item, return); - QString exp = QString::fromUtf8(item->exp); - d->evaluate(exp, [this, iname, exp](const QVariantMap &response) { - d->handleEvaluateExpression(response, iname, exp); - }); + if (state() == InferiorStopOk) { + // The Qt side Q_ASSERTs otherwise. So postpone the evaluation, + // it will be triggered from from upateLocals() later. + QString exp = QString::fromUtf8(item->exp); + d->evaluate(exp, [this, iname, exp](const QVariantMap &response) { + d->handleEvaluateExpression(response, iname, exp); + }); + } } void QmlEngine::selectWatchData(const QByteArray &iname) @@ -1348,6 +1352,10 @@ void QmlEnginePrivate::evaluate(const QString expr, const QmlCallback &cb) // } // } + // The Qt side Q_ASSERTs otherwise. So ignore the request and hope + // it will be repeated soon enough (which it will, e.g. in updateLocals) + QTC_ASSERT(engine->state() == InferiorStopOk, return); + DebuggerCommand cmd(EVALUATE); cmd.arg(EXPRESSION, expr);