src/eric7/Testing/TestingWidget.py

branch
eric7-maintenance
changeset 11194
1bfb44d3bedc
parent 11155
e1843b6efa73
parent 11181
52e30cc024aa
--- a/src/eric7/Testing/TestingWidget.py	Sat Mar 01 16:09:50 2025 +0100
+++ b/src/eric7/Testing/TestingWidget.py	Sun Mar 30 15:10:50 2025 +0200
@@ -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