Commits

Wagner Bruna  committed f41f3ed

merge: do not close the wizard if a command is running (fixes #1338)

The commit page detected completion simply by checking if the merge
revision was already committed. But if a command were still running
at that point (either a Mercurial commit hook or the autopush
feature), the wizard would close too soon, causing a Qt crash
(deleting the Qt thread object before its thread finished).

  • Participants
  • Parent commits ef558f9
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/merge.py

         self.cmd.setShowOutput(False)
         self.layout().addWidget(self.cmd)
 
+        self.delayednext = False
+
         def tryperform():
             if self.isComplete():
                 self.wizard().next()
         return len(self.repo.parents()) == 2 and len(self.msgEntry.text()) > 0
 
     def validatePage(self):
+
+        if self.cmd.core.running():
+            return False
+
         if len(self.repo.parents()) == 1:
             # commit succeeded, repositoryChanged() called wizard().next()
             if self.skiplast.isChecked():
                 self.wizard().close()
             return True
-        if self.cmd.core.running():
-            return False
 
         user = qtlib.getCurrentUsername(self, self.repo)
         if not user:
     def repositoryChanged(self):
         'repository has detected a change to changelog or parents'
         if len(self.repo.parents()) == 1:
-            self.wizard().next()
+            if self.cmd.core.running():
+                # call self.wizard().next() after the current command finishes
+                self.delayednext = True
+            else:
+                self.wizard().next()
 
     def onCommandFinished(self, ret):
         self.repo.decrementBusyCount()
+        if self.delayednext:
+            self.delayednext = False
+            self.wizard().next()
         self.completeChanged.emit()