Skip to content

Commit

Permalink
fix: [debugger] incorrect display of breakpoints`view after file changed
Browse files Browse the repository at this point in the history
Log: as title
  • Loading branch information
LiHua000 authored and deepin-mozart committed Aug 8, 2024
1 parent 85cc215 commit a948768
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/plugins/debugger/dap/dapdebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,8 @@ void DAPDebugger::handleEvents(const dpf::Event &event)
} else if (event.data() == editor.breakpointAdded.name) {
QString filePath = event.property(editor.breakpointAdded.pKeys[0]).toString();
int line = event.property(editor.breakpointAdded.pKeys[1]).toInt();
if (d->bps.contains(filePath) && d->bps.values(filePath).contains(line))
return;
d->bps.insert(filePath, line);
addBreakpoint(filePath, line);
} else if (event.data() == editor.breakpointRemoved.name) {
Expand Down
5 changes: 2 additions & 3 deletions src/plugins/debugger/interface/breakpointmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ void BreakpointModel::setBreakpoints(const Internal::Breakpoints &breakpoints, b

void BreakpointModel::insertBreakpoint(const Internal::Breakpoint &breakpoint)
{
beginResetModel();
auto it = bps.begin();
for (; it != bps.end(); ++it) {
if (it->breakpoint() == breakpoint) {
if (it->breakpoint() == breakpoint)
return;
}
}
beginResetModel();
contentsValid = true;
bps.push_back(BreakpointItem(breakpoint));
endResetModel();
Expand Down

0 comments on commit a948768

Please sign in to comment.