Commits

Yuya Nishihara committed 8b3b003

compress: move completed slot to instance which avoids reference cycle

Now CompressDialog can be deleted by refcount.

Comments (0)

Files changed (2)

tortoisehg/hgqt/compress.py

                         if status == 'u':
                             self.dirty = True
                             break
-        def completed():
-            self.th.wait()
-            if self.th.dirty:
-                self.compressbtn.setEnabled(False)
-                txt = _('Before compress, you must <a href="commit">'
-                        '<b>commit</b></a> or <a href="discard">'
-                        '<b>discard</b></a> changes.')
-            else:
-                self.compressbtn.setEnabled(True)
-                txt = _('You may continue the compress')
-            self.showMessage.emit(txt)
+
         self.th = CheckThread(self)
-        self.th.finished.connect(completed)
+        self.th.finished.connect(self._checkCompleted)
         self.th.start()
 
+    @pyqtSlot()
+    def _checkCompleted(self):
+        self.th.wait()
+        if self.th.dirty:
+            self.compressbtn.setEnabled(False)
+            txt = _('Before compress, you must <a href="commit">'
+                    '<b>commit</b></a> or <a href="discard">'
+                    '<b>discard</b></a> changes.')
+        else:
+            self.compressbtn.setEnabled(True)
+            txt = _('You may continue the compress')
+        self.showMessage.emit(txt)
+
     def compress(self):
         self.cancelbtn.setShown(False)
         uc = ['update', '--repository', self.repo.root, '--clean', '--rev',

tortoisehg/hgqt/repowidget.py

                            _('Selected changeset pair not related'))
                 return
             dlg = compress.CompressDialog(self.repo, revs, self)
-            dlg.finished.connect(dlg.deleteLater)
             dlg.exec_()
 
         menu = QMenu(self)