Commits

Yuya Nishihara committed aa27291

rebase: move completed slot to instance to avoid reference cycle

Now RebaseDialog can be deleted by refcount.

Comments (0)

Files changed (3)

tortoisehg/hgqt/rebase.py

                         if status == 'u':
                             self.dirty = True
                             break
-        def completed():
-            self.th.wait()
-            if self.th.dirty:
-                self.rebasebtn.setEnabled(False)
-                txt = _('Before rebase, you must <a href="commit">'
-                        '<b>commit</b></a> or <a href="discard">'
-                        '<b>discard</b></a> changes.')
-            else:
-                self.rebasebtn.setEnabled(True)
-                txt = _('You may continue the rebase')
-            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.rebasebtn.setEnabled(False)
+            txt = _('Before rebase, you must <a href="commit">'
+                    '<b>commit</b></a> or <a href="discard">'
+                    '<b>discard</b></a> changes.')
+        else:
+            self.rebasebtn.setEnabled(True)
+            txt = _('You may continue the rebase')
+        self.showMessage.emit(txt)
+
     def rebase(self):
         self.rebasebtn.setEnabled(False)
         self.cancelbtn.setShown(False)

tortoisehg/hgqt/repowidget.py

             opts = {'source': self.menuselection[0],
                     'dest': self.menuselection[1]}
             dlg = rebase.RebaseDialog(self._repoagent, self, **opts)
-            dlg.finished.connect(dlg.deleteLater)
             dlg.exec_()
 
         exs = self.repo.extensions()
         """Rebase selected revision on top of working directory parent"""
         opts = {'source' : self.rev, 'dest': self.repo['.'].rev()}
         dlg = rebase.RebaseDialog(self._repoagent, self, **opts)
-        dlg.finished.connect(dlg.deleteLater)
         dlg.exec_()
 
     def qimportRevision(self):

tortoisehg/hgqt/sync.py

             if self.opts.get('rebase') or self.opts.get('updateorrebase'):
                 if os.path.exists(self.repo.join('rebasestate')):
                     dlg = rebase.RebaseDialog(self._repoagent, self)
-                    dlg.finished.connect(dlg.deleteLater)
                     dlg.exec_()
                     return
             # handle file conflicts during update