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 8f3a0ebabb.

Change-Id: I423752be4e4f51198e9e2968a978b57bce43a3ec
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Andrii Semkiv
2024-12-20 11:45:13 +01:00
parent 27103de07e
commit 754bb5847f

View File

@@ -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: