Debugger: Fix breakpoint disabling and enabling in for QML

As QML currently does not expose a command to atomically enable or
disable a breakpoint, we need to remove and re-insert it. The previous
code scheduled the removal through a timer, and depending on if the
timer hit before the insertion or after, the operation was successful or
not.

As the QML engine doesn't have to be in a specific state to insert and
remove breakpoints, we can just directly send the messages instead and
therefore be certain that they arrive in the right order.

Task-number: QTCREATORBUG-20795
Change-Id: If69797b2c75e1107ad552f88e709e1580b4164db
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2018-07-19 14:24:33 +02:00
parent 9b36fb24ef
commit 957d7d83ff

View File

@@ -753,20 +753,17 @@ void QmlEngine::changeBreakpoint(Breakpoint bp)
BreakpointResponse br = bp.response();
if (params.type == BreakpointAtJavaScriptThrow) {
d->setExceptionBreak(AllExceptions, params.enabled);
br.enabled = params.enabled;
bp.setResponse(br);
} else if (params.type == BreakpointOnQmlSignalEmit) {
d->setBreakpoint(EVENT, params.functionName, params.enabled);
br.enabled = params.enabled;
bp.setResponse(br);
} else {
//V8 supports only minimalistic changes in breakpoint
//Remove the breakpoint and add again
bp.notifyBreakpointChangeOk();
bp.removeBreakpoint();
BreakHandler *handler = d->engine->breakHandler();
handler->appendBreakpoint(params);
d->clearBreakpoint(d->breakpoints.take(bp.id()));
d->setBreakpoint(SCRIPTREGEXP, params.fileName,
params.enabled, params.lineNumber, 0,
params.condition, params.ignoreCount);
d->breakpointsSync.insert(d->sequence, bp.id());
}
br.enabled = params.enabled;
bp.setResponse(br);
if (bp.state() == BreakpointChangeProceeding)
bp.notifyBreakpointChangeOk();