Commits

Yuya Nishihara  committed a19ab6f

graft: move completed slot to instance to avoid reference cycle

Now GraftDialog can be deleted by refcount.

  • Participants
  • Parent commits 4bcc875

Comments (0)

Files changed (2)

File tortoisehg/hgqt/graft.py

                         if status == 'u':
                             self.dirty = True
                             break
-        def completed():
-            self.th.wait()
-            if self.th.dirty:
-                self.graftbtn.setEnabled(False)
-                txt = _('Before graft, you must <a href="commit">'
-                        '<b>commit</b></a> or <a href="discard">'
-                        '<b>discard</b></a> changes.')
-            else:
-                self.graftbtn.setEnabled(True)
-                txt = _('You may continue or start the graft')
-            self.showMessage.emit(txt)
         self.th = CheckThread(self)
-        self.th.finished.connect(completed)
+        self.th.finished.connect(self._onCheckFinished)
         self.th.start()
 
+    @pyqtSlot()
+    def _onCheckFinished(self):
+        self.th.wait()
+        if self.th.dirty:
+            self.graftbtn.setEnabled(False)
+            txt = _('Before graft, you must <a href="commit">'
+                    '<b>commit</b></a> or <a href="discard">'
+                    '<b>discard</b></a> changes.')
+        else:
+            self.graftbtn.setEnabled(True)
+            txt = _('You may continue or start the graft')
+        self.showMessage.emit(txt)
+
     def graft(self):
         self.graftbtn.setEnabled(False)
         self.cancelbtn.setShown(False)

File tortoisehg/hgqt/repowidget.py

         if not revlist:
             revlist = [self.rev]
         dlg = graft.GraftDialog(self._repoagent, self, source=revlist)
-        dlg.finished.connect(dlg.deleteLater)
         if dlg.valid:
             dlg.exec_()