Commits

Yuya Nishihara committed 386c27a

filectxactions: release closed file dialog so that it can be deleted

But still, released dialog is not GC-ed because of signal-slot connection
to lambda function.

This does not mark _forgetnavdialog as pyqtSlot due to self.sender() bug of
PyQt 4.7.3.

  • Participants
  • Parent commits 061c0f0
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/filectxactions.py

                     repoviewer = self.parent().window()
                 dlg = dlgclass(repo, filename, repoviewer=repoviewer)
                 dlgdict[self._currentfile] = dlg
+                assert dlg.filename == self._currentfile
+                dlg.finished.connect(self._forgetnavdialog)
                 ufname = hglib.tounicode(filename)
                 dlg.setWindowTitle(_('Hg file log viewer - %s') % ufname)
                 dlg.setWindowIcon(qtlib.geticon('hg-log'))
             dlg.raise_()
             dlg.activateWindow()
 
+    #@pyqtSlot()
+    def _forgetnavdialog(self):
+        dlg = self.sender()
+        dlg.finished.disconnect(self._forgetnavdialog)
+        if isinstance(dlg, FileLogDialog):
+            del self._nav_dialogs[dlg.filename]
+        elif isinstance(dlg, FileDiffDialog):
+            del self._diff_dialogs[dlg.filename]
+
     def _findsub(self, paths):
         """Find the nearest (sub-)repository for the given paths