forked from qt-creator/qt-creator
QML Debugger: Make sure to claim break points before CONNECT
Otherwise we have a race condition. The breakpoints may be hit before they are set. Change-Id: Iccdd64758b150acdfadc18cba88abdf841feb6c7 Fixes: QTCREATORBUG-21253 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -349,8 +349,6 @@ void QmlEngine::connectionEstablished()
|
|||||||
connect(inspectorView(), &WatchTreeView::currentIndexChanged,
|
connect(inspectorView(), &WatchTreeView::currentIndexChanged,
|
||||||
this, &QmlEngine::updateCurrentContext);
|
this, &QmlEngine::updateCurrentContext);
|
||||||
|
|
||||||
BreakpointManager::claimBreakpointsForEngine(this);
|
|
||||||
|
|
||||||
if (state() == EngineRunRequested)
|
if (state() == EngineRunRequested)
|
||||||
notifyEngineRunAndInferiorRunOk();
|
notifyEngineRunAndInferiorRunOk();
|
||||||
}
|
}
|
||||||
@@ -2433,13 +2431,18 @@ void QmlEnginePrivate::stateChanged(State state)
|
|||||||
engine->logServiceStateChange(name(), serviceVersion(), state);
|
engine->logServiceStateChange(name(), serviceVersion(), state);
|
||||||
|
|
||||||
if (state == QmlDebugClient::Enabled) {
|
if (state == QmlDebugClient::Enabled) {
|
||||||
/// Start session.
|
BreakpointManager::claimBreakpointsForEngine(engine);
|
||||||
flushSendBuffer();
|
|
||||||
QJsonObject parameters;
|
// Since the breakpoint claiming is deferred, we need to also defer the connecting
|
||||||
parameters.insert("redundantRefs", false);
|
QTimer::singleShot(0, this, [this]() {
|
||||||
parameters.insert("namesAsObjects", false);
|
/// Start session.
|
||||||
runDirectCommand(CONNECT, QJsonDocument(parameters).toJson());
|
flushSendBuffer();
|
||||||
runCommand({VERSION}, CB(handleVersion));
|
QJsonObject parameters;
|
||||||
|
parameters.insert("redundantRefs", false);
|
||||||
|
parameters.insert("namesAsObjects", false);
|
||||||
|
runDirectCommand(CONNECT, QJsonDocument(parameters).toJson());
|
||||||
|
runCommand({VERSION}, CB(handleVersion));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user