gitk: Fix error when changing colors after closing "List references" window
This fixes an error that manifests itself if the user opens the "List references" window and the closes it, and subsequently opens the Preferences window and changes one of the colors. When the user clicks OK, and error popup appears with the message: Error: invalid command name ".showrefs.list" This is because .showrefs.list was added to the list of windows to be notified on foreground/background color changes, but the window no longer exists. We fix the bug by checking whether the window exists before trying to change its colors. As an optimization, we also avoid adding the .showrefs.list window to the list a second time. Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
18
gitk
18
gitk
@ -9819,8 +9819,10 @@ proc showrefs {} {
|
|||||||
-width 30 -height 20 -cursor $maincursor \
|
-width 30 -height 20 -cursor $maincursor \
|
||||||
-spacing1 1 -spacing3 1 -state disabled
|
-spacing1 1 -spacing3 1 -state disabled
|
||||||
$top.list tag configure highlight -background $selectbgcolor
|
$top.list tag configure highlight -background $selectbgcolor
|
||||||
lappend bglist $top.list
|
if {![lsearch -exact $bglist $top.list]} {
|
||||||
lappend fglist $top.list
|
lappend bglist $top.list
|
||||||
|
lappend fglist $top.list
|
||||||
|
}
|
||||||
${NS}::scrollbar $top.ysb -command "$top.list yview" -orient vertical
|
${NS}::scrollbar $top.ysb -command "$top.list yview" -orient vertical
|
||||||
${NS}::scrollbar $top.xsb -command "$top.list xview" -orient horizontal
|
${NS}::scrollbar $top.xsb -command "$top.list xview" -orient horizontal
|
||||||
grid $top.list $top.ysb -sticky nsew
|
grid $top.list $top.ysb -sticky nsew
|
||||||
@ -11532,7 +11534,9 @@ proc choosecolor {v vi w x cmd} {
|
|||||||
proc setselbg {c} {
|
proc setselbg {c} {
|
||||||
global bglist cflist
|
global bglist cflist
|
||||||
foreach w $bglist {
|
foreach w $bglist {
|
||||||
$w configure -selectbackground $c
|
if {[winfo exists $w]} {
|
||||||
|
$w configure -selectbackground $c
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$cflist tag configure highlight \
|
$cflist tag configure highlight \
|
||||||
-background [$cflist cget -selectbackground]
|
-background [$cflist cget -selectbackground]
|
||||||
@ -11558,7 +11562,9 @@ proc setbg {c} {
|
|||||||
global bglist
|
global bglist
|
||||||
|
|
||||||
foreach w $bglist {
|
foreach w $bglist {
|
||||||
$w conf -background $c
|
if {[winfo exists $w]} {
|
||||||
|
$w conf -background $c
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11566,7 +11572,9 @@ proc setfg {c} {
|
|||||||
global fglist canv
|
global fglist canv
|
||||||
|
|
||||||
foreach w $fglist {
|
foreach w $fglist {
|
||||||
$w conf -foreground $c
|
if {[winfo exists $w]} {
|
||||||
|
$w conf -foreground $c
|
||||||
|
}
|
||||||
}
|
}
|
||||||
allcanvs itemconf text -fill $c
|
allcanvs itemconf text -fill $c
|
||||||
$canv itemconf circle -outline $c
|
$canv itemconf circle -outline $c
|
||||||
|
Reference in New Issue
Block a user