Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v2 git-gui] git-gui--askpass: Do not hang on exit

From: Pat Thoyts <hidden>
Date: 2016-06-15 22:49:19

Jonathan Nieder [off-list ref] writes:
quoted hunk
Anders Kaseorg wrote:
quoted
When git-gui--askpass is manually copied from the source into
/usr/lib/git-core, though, it doesn’t particularly work; its window
just freezes after the password is typed.
The problem seems to be the

 bind . <Destroy>    {exit $::rc}

line; apparently each exit causes the window to be destroyed again,
resulting in git gui hanging.

Reported-by: Anders Kaseorg <redacted>
Signed-off-by: Jonathan Nieder <redacted>
---
I wrote:
quoted
@@ -52,7 +52,9 @@ proc finish {} {
 
 	set ::rc 0
 	puts $::answer
+	bind . <Destroy> {}
 	destroy .
but that does nothing to help the case when the destroy event
comes from the window manager.  Here’s a saner patch (sorry for
the noise).
diff --git a/git-gui--askpass b/git-gui--askpass
index 12e117e..20b8799 100755
--- a/git-gui--askpass
+++ b/git-gui--askpass
@@ -39,7 +39,10 @@ pack .b -side bottom -fill x -padx 10 -pady 10
bind . <Visibility> {focus -force .e}
bind . <Key-Return> finish
bind . <Key-Escape> {destroy .}
-bind . <Destroy>    {exit $rc}
+bind . <Destroy>    {
+	bind . <Destroy> {}
+	exit $::rc
+}

proc finish {} {
	if {$::yesno} {
I'm not so keen to take this patch for git-gui. Exiting from bindings
isn't such great Tk style and I'd rather we used a vwait to explicitly
run the event loop and exit after terminating that. The following patch
does this. 'git-gui: change the termination checks to avoid potential hang'

I'm not certain of the conditions that produced the error this is
supposed to fix. I have not reproduced the hang so far on a linux system
using Tk 8.5. It would be good to get confirmation that my proposed
patch actually solves the issue reported.

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help