Skip to content

Commit

Permalink
gitk: Fix crash when not using themed widgets
Browse files Browse the repository at this point in the history
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 <mk@acc.umu.se>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Marcus Karlsson authored and Paul Mackerras committed Oct 21, 2012
1 parent ebb91db commit 62e9ac5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions gitk
Original file line number Diff line number Diff line change
Expand Up @@ -2182,11 +2182,19 @@ proc makewindow {} {
image create bitmap bm-right -data $bm_right_data
image create bitmap bm-right-gray -data $bm_right_data -foreground "#999"

${NS}::button .tf.bar.leftbut -image [list bm-left disabled bm-left-gray] \
-command goback -state disabled -width 26
${NS}::button .tf.bar.leftbut -command goback -state disabled -width 26
if {$use_ttk} {
.tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray]
} else {
.tf.bar.leftbut configure -image bm-left
}
pack .tf.bar.leftbut -side left -fill y
${NS}::button .tf.bar.rightbut -image [list bm-right disabled bm-right-gray] \
-command goforw -state disabled -width 26
${NS}::button .tf.bar.rightbut -command goforw -state disabled -width 26
if {$use_ttk} {
.tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray]
} else {
.tf.bar.rightbut configure -image bm-right
}
pack .tf.bar.rightbut -side left -fill y

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

0 comments on commit 62e9ac5

Please sign in to comment.