Commit 5eeedbe5 authored by Milian Wolff's avatar Milian Wolff
Browse files

Don't leak deleted breakpoints

But really, this is just a stop-gap measure to
prevent LSAN reports in the unit test. We still
basically leak the deleted breakpoints until we
destroy the model, so nothing really is won here.
But it seems like the whole ownership and lifetime
tracking of breakpoints is utterly broken. Note how
we store e.g. raw pointers in the breakpoint controller
and don't seem to clean those up ever properly either...
parent 927b758b
......@@ -74,6 +74,10 @@ public:
bool dirty = false;
bool dontUpdateMarks = false;
QList<Breakpoint*> breakpoints;
/// FIXME: this is just an ugly workaround to not leak deleted breakpoints
/// a real fix would make sure that we actually delete breakpoints
/// right when we delete them... aka remove Breakpoint::{set}deleted
QList<Breakpoint*> deletedBreakpoints;
BreakpointModel::BreakpointModel(QObject* parent)
......@@ -108,6 +112,7 @@ BreakpointModel::~BreakpointModel()
void BreakpointModel::slotPartAdded(KParts::Part* part)
......@@ -280,6 +285,9 @@ bool KDevelop::BreakpointModel::removeRows(int row, int count, const QModelIndex
b->m_model = nullptr;
// To be changed: the controller is currently still responsible for deleting the breakpoint
// object
// FIXME: this whole notion of m_deleted is utterly broken and needs to be fixed properly
// for now just prevent a leak...
......@@ -424,14 +424,14 @@ void GdbTest::testDeleteBreakpoint()
//add breakpoint before startDebugging
breakpoints()->addCodeBreakpoint(QUrl::fromLocalFile(debugeeFileName), 21);
QCOMPARE(breakpoints()->rowCount(), 1);
QCOMPARE(breakpoints()->rowCount(), 0);
breakpoints()->addCodeBreakpoint(QUrl::fromLocalFile(debugeeFileName), 22);
session->startDebugging(&cfg, m_iface);
WAIT_FOR_STATE_AND_IDLE(session, DebugSession::PausedState);
WAIT_FOR_STATE(session, DebugSession::EndedState);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment