[PATCH] cmdui: keep running state just before emitting commandFinished (fixes #2611)

4 views
Skip to first unread message

Yuya Nishihara

unread,
May 22, 2013, 12:15:31 PM5/22/13
to thg...@googlegroups.com
Hi,

This is bugfix patch, but intended for default branch. The problem won't
happen in stable release.

https://bitbucket.org/tortoisehg/thg/issue/2611/

# HG changeset patch
# User Yuya Nishihara <yu...@tcha.org>
# Date 1369148397 -32400
# Tue May 21 23:59:57 2013 +0900
# Node ID 325ef91d6b47c9eee9c5a1bc9fd4c6842f072fff
# Parent 96275cf8d36474942e299868eefa16deb3bda243
cmdui: keep running state just before emitting commandFinished (fixes #2611)

MergeDialog checks cmd.running() on repositoryChanged. But thread.isRunning()
is cleared slightly earlier than finished slot. Thus, the dialog may exit
before clean-up.

diff --git a/tortoisehg/hgqt/cmdui.py b/tortoisehg/hgqt/cmdui.py
--- a/tortoisehg/hgqt/cmdui.py
+++ b/tortoisehg/hgqt/cmdui.py
@@ -228,7 +228,10 @@ class Core(QObject):
if self.extproc:
return self.extproc.state() != QProcess.NotRunning
elif self.thread:
- return self.thread.isRunning()
+ # keep "running" until just before emitting commandFinished.
+ # thread.isRunning() is cleared earlier than onThreadFinished,
+ # because inter-thread signal is queued.
+ return True
except AttributeError:
pass
return False

Steve Borho

unread,
May 29, 2013, 9:26:36 PM5/29/13
to thg...@googlegroups.com
On Wed, May 22, 2013 at 11:15 AM, Yuya Nishihara <yu...@tcha.org> wrote:
Hi,

This is bugfix patch, but intended for default branch. The problem won't
happen in stable release.

https://bitbucket.org/tortoisehg/thg/issue/2611/

# HG changeset patch
# User Yuya Nishihara <yu...@tcha.org>
# Date 1369148397 -32400
#      Tue May 21 23:59:57 2013 +0900
# Node ID 325ef91d6b47c9eee9c5a1bc9fd4c6842f072fff
# Parent  96275cf8d36474942e299868eefa16deb3bda243
cmdui: keep running state just before emitting commandFinished (fixes #2611)

MergeDialog checks cmd.running() on repositoryChanged. But thread.isRunning()
is cleared slightly earlier than finished slot. Thus, the dialog may exit
before clean-up.

Looks fine.
 
diff --git a/tortoisehg/hgqt/cmdui.py b/tortoisehg/hgqt/cmdui.py
--- a/tortoisehg/hgqt/cmdui.py
+++ b/tortoisehg/hgqt/cmdui.py
@@ -228,7 +228,10 @@ class Core(QObject):
             if self.extproc:
                 return self.extproc.state() != QProcess.NotRunning
             elif self.thread:
-                return self.thread.isRunning()
+                # keep "running" until just before emitting commandFinished.
+                # thread.isRunning() is cleared earlier than onThreadFinished,
+                # because inter-thread signal is queued.
+                return True
         except AttributeError:
             pass
         return False

--
You received this message because you are subscribed to the Google Groups "TortoiseHg Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thg-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
Steve Borho

Yuya Nishihara

unread,
May 30, 2013, 7:58:08 AM5/30/13
to thg...@googlegroups.com
On Wed, 29 May 2013 20:26:36 -0500, Steve Borho wrote:
> On Wed, May 22, 2013 at 11:15 AM, Yuya Nishihara <yu...@tcha.org> wrote:
> > This is bugfix patch, but intended for default branch. The problem won't
> > happen in stable release.
> >
> > https://bitbucket.org/tortoisehg/thg/issue/2611/
> >
> > # HG changeset patch
> > # User Yuya Nishihara <yu...@tcha.org>
> > # Date 1369148397 -32400
> > # Tue May 21 23:59:57 2013 +0900
> > # Node ID 325ef91d6b47c9eee9c5a1bc9fd4c6842f072fff
> > # Parent 96275cf8d36474942e299868eefa16deb3bda243
> > cmdui: keep running state just before emitting commandFinished (fixes
> > #2611)
> >
> > MergeDialog checks cmd.running() on repositoryChanged. But
> > thread.isRunning()
> > is cleared slightly earlier than finished slot. Thus, the dialog may exit
> > before clean-up.
>
> Looks fine.

Thanks. Pushed to default.

Regards,
Reply all
Reply to author
Forward
0 new messages