diff --git a/src/plugins/debugger/dap/dapdebugger.cpp b/src/plugins/debugger/dap/dapdebugger.cpp index 7ceaaa505..9cd972af2 100644 --- a/src/plugins/debugger/dap/dapdebugger.cpp +++ b/src/plugins/debugger/dap/dapdebugger.cpp @@ -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) { diff --git a/src/plugins/debugger/interface/breakpointmodel.cpp b/src/plugins/debugger/interface/breakpointmodel.cpp index c9b81b486..f1bde1bef 100644 --- a/src/plugins/debugger/interface/breakpointmodel.cpp +++ b/src/plugins/debugger/interface/breakpointmodel.cpp @@ -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();