Skip to content

Commit 62e9ac5

Browse files
Marcus Karlssonpaulusmack
authored andcommitted
gitk: Fix crash when not using themed widgets
When configured not to use themed widgets gitk may crash on launch with a message that says that the image "bm-left disabled bm-left-gray" doesn't exist. This happens when the left and right arrow buttons are created. The crash can be avoided by configuring the buttons differently depending on whether or not themed widgets are used. If themed widgets are not used then only set the images to bm-left and bm-right respectively, and keep the old behavior when themed widgets are used. The previous behaviour was added in f062e50 to work around a bug in Tk on OS X where the disabled state did not display properly. The buttons may still not display correctly, however the workaround added in f062e50 will still apply if gitk is used with themed widgets. Make gitk not crash on launch when not using themed widgets. Signed-off-by: Marcus Karlsson <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent ebb91db commit 62e9ac5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

gitk

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,11 +2182,19 @@ proc makewindow {} {
21822182
image create bitmap bm-right -data $bm_right_data
21832183
image create bitmap bm-right-gray -data $bm_right_data -foreground "#999"
21842184

2185-
${NS}::button .tf.bar.leftbut -image [list bm-left disabled bm-left-gray] \
2186-
-command goback -state disabled -width 26
2185+
${NS}::button .tf.bar.leftbut -command goback -state disabled -width 26
2186+
if {$use_ttk} {
2187+
.tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray]
2188+
} else {
2189+
.tf.bar.leftbut configure -image bm-left
2190+
}
21872191
pack .tf.bar.leftbut -side left -fill y
2188-
${NS}::button .tf.bar.rightbut -image [list bm-right disabled bm-right-gray] \
2189-
-command goforw -state disabled -width 26
2192+
${NS}::button .tf.bar.rightbut -command goforw -state disabled -width 26
2193+
if {$use_ttk} {
2194+
.tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray]
2195+
} else {
2196+
.tf.bar.rightbut configure -image bm-right
2197+
}
21902198
pack .tf.bar.rightbut -side left -fill y
21912199

21922200
${NS}::label .tf.bar.rowlabel -text [mc "Row"]

0 commit comments

Comments
 (0)