src/eric7/Debugger/BreakPointModel.py

branch
eric7
changeset 11037
adfda913834a
parent 10683
779cda568acb
child 11046
478b4ce023dd
diff -r 326ae637285d -r adfda913834a src/eric7/Debugger/BreakPointModel.py
--- a/src/eric7/Debugger/BreakPointModel.py	Sun Nov 03 18:16:47 2024 +0100
+++ b/src/eric7/Debugger/BreakPointModel.py	Mon Nov 04 11:39:18 2024 +0100
@@ -272,10 +272,12 @@
         @type tuple of (str, bool, bool, int)
         """
         bp = [fn, line] + list(properties)
-        cnt = len(self.breakpoints)
-        self.beginInsertRows(QModelIndex(), cnt, cnt)
-        self.breakpoints.append(bp)
-        self.endInsertRows()
+        if bp not in self.breakpoints:
+            # add it only, if not present already
+            cnt = len(self.breakpoints)
+            self.beginInsertRows(QModelIndex(), cnt, cnt)
+            self.breakpoints.append(bp)
+            self.endInsertRows()
 
     def addBreakPoints(self, breakpoints):
         """
@@ -285,10 +287,14 @@
             condition, temporary flag, enabled flag and ignore count each
         @type list of (str, int, str, bool, bool, int)
         """
-        cnt = len(self.breakpoints)
-        self.beginInsertRows(QModelIndex(), cnt, cnt + len(breakpoints) - 1)
-        self.breakpoints += breakpoints
-        self.endInsertRows()
+        # eliminate redundant break points
+        newBreakpoints = [b for b in set(breakpoints) if b not in self.breakpoints]
+
+        if newBreakpoints:
+            cnt = len(self.breakpoints)
+            self.beginInsertRows(QModelIndex(), cnt, cnt + len(newBreakpoints) - 1)
+            self.breakpoints += newBreakpoints
+            self.endInsertRows()
 
     def setBreakPointByIndex(self, index, fn, line, properties):
         """

eric ide

mercurial