From 957d7d83ff9e6a7ce446a86861d8e9ca46357986 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 19 Jul 2018 14:24:33 +0200 Subject: [PATCH] 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 --- src/plugins/debugger/qml/qmlengine.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 2e0f655abd5..c62856be4aa 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -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();