From 754bb5847faaebbc129f55df667e2bd5cd7a720d Mon Sep 17 00:00:00 2001 From: Andrii Semkiv Date: Fri, 20 Dec 2024 11:45:13 +0100 Subject: [PATCH] Debugger: Fix enabling breakpoints on click Calling `BreakpointItem::setEnabled` from `BreakpointMarker::clicked` is wrong and dangerous. It never actually enables a global breakpoint, just updates the marker. While doing so, it calls `BreakpointItem::adjustMarker`, which in turn calls `BreakpointItem::destroyMarker`, which destroys the original marker, hence the dangerous part. What we actually want is simply enable the corresponding global breakpoint instead. Amends 8f3a0ebabbb03d6d95a354ad648d3a55b5ff0214. Change-Id: I423752be4e4f51198e9e2968a978b57bce43a3ec Reviewed-by: hjk --- src/plugins/debugger/breakhandler.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index e4472309f2c..8a24e7e8269 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -120,10 +120,14 @@ public: void clicked() final { QTC_ASSERT(m_bp, return); - if (!m_bp->isEnabled()) - m_bp->setEnabled(true); - else + + if (m_bp->isEnabled()) { m_bp->deleteGlobalOrThisBreakpoint(); + return; + } + + if (const GlobalBreakpoint gbp = m_bp->globalBreakpoint()) + gbp->setEnabled(true); } public: