git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-gui: change the termination checks to avoid potential hang.

From
Pat Thoyts <patthoyts@users.sourceforge.net>
Date
Aug 14, 2010, 23:21 UTC
Message-ID
<87iq3bh1op.fsf_-_@fox.patthoyts.tk>
In-Reply-To
<20100704212439.GA1765@burratino>

Supposedly the askpass utility can hang under some circumstances. This patch adjusts the Tk application to terminate properly and should avoid this problem.

Reported-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
 git-gui--askpass |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/git-gui--askpass b/git-gui--askpass
index 12e117e..8ba4779 100755
--- a/git-gui--askpass
+++ b/git-gui--askpass
@@ -30,16 +30,20 @@ if {!$yesno} {
 
 frame .b
 button .b.ok     -text OK     -command finish
-button .b.cancel -text Cancel -command {destroy .}
+button .b.cancel -text Cancel -command cancel
 
 pack .b.ok -side left -expand 1
 pack .b.cancel -side right -expand 1
 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 . <Key-Return> [list .b.ok invoke]
+bind . <Key-Escape> [list .b.cancel invoke]
+bind . <Destroy>    {set rc $rc}
+
+proc cancel {} {
+	set ::rc 255
+}
 
 proc finish {} {
 	if {$::yesno} {
@@ -50,10 +54,11 @@ proc finish {} {
 		}
 	}
 
-	set ::rc 0
 	puts $::answer
-	destroy .
+	set ::rc 0
 }
 
 wm title . "OpenSSH"
 tk::PlaceWindow .
+vwait rc
+exit $rc
-- 
1.7.2.1.44.g721e7
Previous: Jonathan NiederNext: Jonathan Nieder
Message 3 of 6 in “git-gui--askpass: Do not hang on exit”
  1. git-gui--askpass: Do not hang on exitJonathan Nieder, Jul 4, 2010
  2. git-gui--askpass: Do not hang on exitJonathan Nieder, Jul 4, 2010
  3. git-gui: change the termination checks to avoid potential hang.Pat Thoyts, Aug 14, 2010
  4. Jonathan NiederAug 18, 2010
  5. Pat ThoytsAug 18, 2010
  6. Pat ThoytsAug 15, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.