Commits

Yuya Nishihara committed c2737ae

refine

Comments (0)

Files changed (2)

qtapp-ownbywb.diff

 # HG changeset patch
-# Parent 06ecd157c32d11d3262a1c2639ee1872c0c69d05
+# Parent 6d5151fcad5666c67280ad3c8f4e949c2bb0d8ac
 
 diff --git a/tortoisehg/hgqt/qtapp.py b/tortoisehg/hgqt/qtapp.py
 --- a/tortoisehg/hgqt/qtapp.py
  
      def __call__(self, dlgfunc, ui, *args, **opts):
          if self._mainapp:
-@@ -380,21 +379,16 @@ class QtRunner(QObject):
+@@ -380,21 +379,17 @@ class QtRunner(QObject):
          if not dlg:
              return
  
 -        self._dialogs[dlg] = reporoot  # avoid garbage collection
          dlg.setAttribute(Qt.WA_DeleteOnClose)
+         if reporoot:
+             dlg.destroyed[()].connect(self._reporeleaser.map)
+             self._reporeleaser.setMapping(dlg, reporoot)
 -        # NOTE: Somehow `destroyed` signal doesn't emit the original obj.
 -        # So we cannot write `dlg.destroyed.connect(self._forgetdialog)`.
 -        dlg.destroyed.connect(lambda: self._forgetdialog(dlg))
-         if reporoot:
-             dlg.destroyed[()].connect(self._reporeleaser.map)
-             self._reporeleaser.setMapping(dlg, reporoot)
 +        if dlg is not self._workbench and not dlg.parent():
-+            # avoid garbage collection
++            # keep reference to avoid garbage collection.  workbench should
++            # exist when run.dispatch() is called for the second time.
 +            assert self._workbench
 +            dlg.setParent(self._workbench, dlg.windowFlags())
          dlg.show()

qtapp-sigmap-release.diff

 # HG changeset patch
-# Parent 19bf531fee81b13516db9b769fccc5024a7f8e5c
+# Parent d23e0fcc9eb6e7ce6a1ad3e032ad5d6d3e81167d
 
 diff --git a/tortoisehg/hgqt/qtapp.py b/tortoisehg/hgqt/qtapp.py
 --- a/tortoisehg/hgqt/qtapp.py
  
          dlg, reporoot = self._createdialog(dlgfunc, args, opts)
          try:
-@@ -382,14 +385,15 @@ class QtRunner(QObject):
+@@ -379,6 +382,9 @@ class QtRunner(QObject):
+ 
+         self._dialogs[dlg] = reporoot  # avoid garbage collection
+         dlg.setAttribute(Qt.WA_DeleteOnClose)
++        if reporoot:
++            dlg.destroyed[()].connect(self._reporeleaser.map)
++            self._reporeleaser.setMapping(dlg, reporoot)
          # NOTE: Somehow `destroyed` signal doesn't emit the original obj.
          # So we cannot write `dlg.destroyed.connect(self._forgetdialog)`.
          dlg.destroyed.connect(lambda: self._forgetdialog(dlg))
-+        if reporoot:
-+            dlg.destroyed[()].connect(self._reporeleaser.map)
-+            self._reporeleaser.setMapping(dlg, reporoot)
-         dlg.show()
- 
-     def _forgetdialog(self, dlg):
+@@ -388,8 +394,6 @@ class QtRunner(QObject):
          """forget the dialog to be garbage collectable"""
          assert dlg in self._dialogs
          reporoot = self._dialogs.pop(dlg)
 diff --git a/tortoisehg/hgqt/thgrepo.py b/tortoisehg/hgqt/thgrepo.py
 --- a/tortoisehg/hgqt/thgrepo.py
 +++ b/tortoisehg/hgqt/thgrepo.py
-@@ -454,6 +454,7 @@ class RepoManager(QObject):
-             self._sigmappers.append(mapper)
-             QObject.connect(mapper, SIGNAL('mapped(QString)'), self, slot)
- 
-+    @pyqtSlot(unicode)
-     def openRepoAgent(self, path):
-         """Return RepoAgent for the specified path and increment refcount"""
-         path = _normreporoot(path)
-@@ -477,6 +478,7 @@ class RepoManager(QObject):
+@@ -477,6 +477,7 @@ class RepoManager(QObject):
          self.repositoryOpened.emit(path)
          return agent