src/eric7/Testing/TestingWidget.py

branch
eric7
changeset 11181
52e30cc024aa
parent 11148
15e30f0c76a8
child 11194
1bfb44d3bedc
child 11230
8a15b05eeee3
--- a/src/eric7/Testing/TestingWidget.py	Fri Mar 21 16:27:43 2025 +0100
+++ b/src/eric7/Testing/TestingWidget.py	Fri Mar 21 16:29:08 2025 +0100
@@ -1364,12 +1364,24 @@
         """
         from eric7.QScintilla.MiniEditor import MiniEditor
 
-        editor = MiniEditor(filename, "Python3", self)
+        editor = MiniEditor(filename, "Python3")
+        editor.closing.connect(lambda: self.__editorClosing(editor))
         editor.gotoLine(linenumber)
         editor.show()
 
         self.__editors.append(editor)
 
+    def __editorClosing(self, editor):
+        """
+        Private method called, when an editor is closing.
+
+        @param editor reference to the closing editor
+        @type MiniEditor
+        """
+        with contextlib.suppress(ValueError):
+            self.__editors.remove(editor)
+            del editor
+
     def closeEvent(self, event):
         """
         Protected method to handle the close event.
@@ -1377,12 +1389,12 @@
         @param event close event
         @type QCloseEvent
         """
-        event.accept()
-
         for editor in self.__editors:
             with contextlib.suppress(RuntimeError):
                 editor.close()
 
+        event.accept()
+
     @pyqtSlot(str)
     def on_statusFilterComboBox_currentTextChanged(self, status):
         """

eric ide

mercurial