{"thread":{"id":"31746","subject":"[PATCH] gitk: Fix crash when not using themed widgets","startedAt":"2012-10-07T21:21:14Z","lastAt":"2012-10-21T22:22:34Z","messageCount":2,"participants":["Marcus Karlsson","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"200715","messageId":"1349644874-22988-1-git-send-email-mk@acc.umu.se","threadId":"31746","inReplyTo":null,"subject":"[PATCH] gitk: Fix crash when not using themed widgets","fromName":"Marcus Karlsson","fromEmail":"mk@acc.umu.se","sentAt":"2012-10-07T21:21:14Z","receivedAt":"2012-10-07T21:21:14Z","isPatch":true,"sender":{"key":"mk@acc.umu.se","avatar":null},"body":"When configured not to use themed widgets gitk may crash on launch with\na message that says that the image \"bm-left disabled bm-left-gray\"\ndoesn't exist. This happens when the left and right arrow buttons are\ncreated.\n\nThe crash can be avoided by configuring the buttons differently\ndepending on whether or not themed widgets are used. If themed widgets\nare not used then only set the images to bm-left and bm-right\nrespectively, and keep the old behavior when themed widgets are used.\n\nThe previous behaviour was added in f062e50f to work around a bug in Tk\non OS X where the disabled state did not display properly. The buttons\nmay still not display correctly, however the workaround added in\nf062e50f will still apply if gitk is used with themed widgets.\n\nMake gitk not crash on launch when not using themed widgets.\n\nSigned-off-by: Marcus Karlsson <mk@acc.umu.se>\n---\n gitk |   16 ++++++++++++----\n 1 file changed, 12 insertions(+), 4 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 379582a..02ffd9b 100755\n--- a/gitk\n+++ b/gitk\n@@ -2182,11 +2182,19 @@ proc makewindow {} {\n     image create bitmap bm-right -data $bm_right_data\n     image create bitmap bm-right-gray -data $bm_right_data -foreground \"#999\"\n \n-    ${NS}::button .tf.bar.leftbut -image [list bm-left disabled bm-left-gray] \\\n-\t-command goback -state disabled -width 26\n+    ${NS}::button .tf.bar.leftbut -command goback -state disabled -width 26\n+    if {$use_ttk} {\n+\t.tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray]\n+    } else {\n+\t.tf.bar.leftbut configure -image bm-left\n+    }\n     pack .tf.bar.leftbut -side left -fill y\n-    ${NS}::button .tf.bar.rightbut -image [list bm-right disabled bm-right-gray] \\\n-\t-command goforw -state disabled -width 26\n+    ${NS}::button .tf.bar.rightbut -command goforw -state disabled -width 26\n+    if {$use_ttk} {\n+\t.tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray]\n+    } else {\n+\t.tf.bar.rightbut configure -image bm-right\n+    }\n     pack .tf.bar.rightbut -side left -fill y\n \n     ${NS}::label .tf.bar.rowlabel -text [mc \"Row\"]\n-- \n1.7.10.4\n"},{"id":"201669","messageId":"20121021222234.GB7407@bloggs.ozlabs.ibm.com","threadId":"31746","inReplyTo":"1349644874-22988-1-git-send-email-mk@acc.umu.se","subject":"Re: [PATCH] gitk: Fix crash when not using themed widgets","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2012-10-21T22:22:34Z","receivedAt":"2012-10-21T22:22:34Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Sun, Oct 07, 2012 at 11:21:14PM +0200, Marcus Karlsson wrote:\n> When configured not to use themed widgets gitk may crash on launch with\n> a message that says that the image \"bm-left disabled bm-left-gray\"\n> doesn't exist. This happens when the left and right arrow buttons are\n> created.\n> \n> The crash can be avoided by configuring the buttons differently\n> depending on whether or not themed widgets are used. If themed widgets\n> are not used then only set the images to bm-left and bm-right\n> respectively, and keep the old behavior when themed widgets are used.\n> \n> The previous behaviour was added in f062e50f to work around a bug in Tk\n> on OS X where the disabled state did not display properly. The buttons\n> may still not display correctly, however the workaround added in\n> f062e50f will still apply if gitk is used with themed widgets.\n> \n> Make gitk not crash on launch when not using themed widgets.\n> \n> Signed-off-by: Marcus Karlsson <mk@acc.umu.se>\n\nThanks, applied.\n\nPaul.\n"}]}