Fixed an issue in the new Search & Replace widget caused by maintaining a reference to an already closed editor. eric7

Wed, 29 Mar 2023 11:32:06 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 29 Mar 2023 11:32:06 +0200
branch
eric7
changeset 9943
02a40e8bd135
parent 9942
cf725cf57445
child 9944
011ae0edbcff

Fixed an issue in the new Search & Replace widget caused by maintaining a reference to an already closed editor.

src/eric7/QScintilla/SearchReplaceWidget.py file | annotate | diff | comparison | revisions
src/eric7/ViewManager/ViewManager.py file | annotate | diff | comparison | revisions
--- a/src/eric7/QScintilla/SearchReplaceWidget.py	Wed Mar 29 10:45:00 2023 +0200
+++ b/src/eric7/QScintilla/SearchReplaceWidget.py	Wed Mar 29 11:32:06 2023 +0200
@@ -964,6 +964,17 @@
             self.selectionCheckBox.setChecked(False)
             self.__selections = []
 
+    @pyqtSlot(Editor)
+    def editorClosed(self, editor):
+        """
+        Public slot to handle the closing of an editor.
+
+        @param editor reference to the closed editor
+        @type Editor
+        """
+        if self.__currentEditor is not None and self.__currentEditor is editor:
+            self.__currentEditor = None
+
     def replace(self):
         """
         Public method to replace the current selection.
@@ -1430,6 +1441,16 @@
         """
         self.__searchReplaceWidget.updateSelectionCheckBox(editor)
 
+    @pyqtSlot(Editor)
+    def editorClosed(self, editor):
+        """
+        Public slot to handle the closing of an editor.
+
+        @param editor reference to the closed editor
+        @type Editor
+        """
+        self.__searchReplaceWidget.editorClosed(editor)
+
     def show(self, text="", replaceMode=False):
         """
         Public slot to show the widget.
--- a/src/eric7/ViewManager/ViewManager.py	Wed Mar 29 10:45:00 2023 +0200
+++ b/src/eric7/ViewManager/ViewManager.py	Wed Mar 29 11:32:06 2023 +0200
@@ -162,6 +162,7 @@
 
         self.__searchReplaceWidget = SearchReplaceSlidingWidget(self, ui)
 
+        self.editorClosedEd.connect(self.__searchReplaceWidget.editorClosed)
         self.checkActions.connect(self.__searchReplaceWidget.updateSelectionCheckBox)
 
     def searchReplaceWidget(self):

eric ide

mercurial