@matheusbsbs / matheus-bagliano / commits / e54be9e30f
Fork 0

gitk: show_error fix

Bug noted by Junio C Hamano: show_error can be passed "." (root window) as its $w argument, but appending ".m" and ".ok" results in creating "..m" and "..ok" as window paths, which were invalid. This fixes it in a slightly different way from Junio's patch, though. Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed May 26, 2006 at 22:34 UTC e54be9e30ffb8ab21fe9ef740991940f4d00e79c
1 file changed +8 -8
gitk
+8 -8
@@ -357,21 +357,21 @@ proc readrefs {} {
357 close $refd
358 }
359
360 -proc show_error {w msg} {
360 +proc show_error {w top msg} {
361 message $w.m -text $msg -justify center -aspect 400
362 pack $w.m -side top -fill x -padx 20 -pady 20
363 - button $w.ok -text OK -command "destroy $w"
363 + button $w.ok -text OK -command "destroy $top"
364 pack $w.ok -side bottom -fill x
365 - bind $w <Visibility> "grab $w; focus $w"
366 - bind $w <Key-Return> "destroy $w"
367 - tkwait window $w
365 + bind $top <Visibility> "grab $top; focus $top"
366 + bind $top <Key-Return> "destroy $top"
367 + tkwait window $top
368 }
369
370 proc error_popup msg {
371 set w .error
372 toplevel $w
373 wm transient $w .
374 - show_error $w $msg
374 + show_error $w $w $msg
375 }
376
377 proc makewindow {} {
@@ -4917,7 +4917,7 @@ foreach arg $argv {
4917 # check that we can find a .git directory somewhere...
4918 set gitdir [gitdir]
4919 if {![file isdirectory $gitdir]} {
4920 - show_error . "Cannot find the git directory \"$gitdir\"."
4920 + show_error {} . "Cannot find the git directory \"$gitdir\"."
4921 exit 1
4922 }
4923
@@ -4939,7 +4939,7 @@ if {$i >= 0} {
4939 if {$i > 0} {
4940 set err [string range $err [expr {$i + 6}] end]
4941 }
4942 - show_error . "Bad arguments to gitk:\n$err"
4942 + show_error {} . "Bad arguments to gitk:\n$err"
4943 exit 1
4944 }
4945 }