{"thread":{"id":"13558","subject":"[PATCH] gitk: avoid error on reload","startedAt":"2008-05-17T20:55:52Z","lastAt":"2008-05-18T23:51:58Z","messageCount":2,"participants":["Michele Ballabio","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"77206","messageId":"200805172255.52828.barra_cuda@katamail.com","threadId":"13558","inReplyTo":null,"subject":"[PATCH] gitk: avoid error on reload","fromName":"Michele Ballabio","fromEmail":"barra_cuda@katamail.com","sentAt":"2008-05-17T20:55:52Z","receivedAt":"2008-05-17T20:55:52Z","isPatch":true,"sender":{"key":"barra_cuda@katamail.com","avatar":"https://avatars.githubusercontent.com/u/16371673?v=4"},"body":"When hitting \"Reload\", gitk can error out, complaining\nabout \"wrong # coordinates: expected 0 or 4, got 2\".\nThis patch checks that there are 4 coordinates to avoid this\nerror:\n\nwrong # coordinates: expected 0 or 4, got 2\nwrong # coordinates: expected 0 or 4, got 2\n    while executing\n\".tf.histframe.pwclist.canv create rect -outline {} -tags secsel -fill gray85\"\n    (\"eval\" body line 1)\n    invoked from within\n\"eval $canv create rect [$canv bbox $linehtag($l)] -outline {{}}  -tags secsel -fill [$canv cget -selectbackground]\"\n    (procedure \"make_secsel\" line 6)\n    invoked from within\n\"make_secsel $l\"\n    (procedure \"selectline\" line 62)\n    invoked from within\n\"selectline [rowofcommit $pending_select] 1\"\n    (procedure \"layoutmore\" line 12)\n    invoked from within\n\"layoutmore\"\n    (procedure \"chewcommits\" line 5)\n    invoked from within\n\"chewcommits\"\n    (\"eval\" body line 1)\n    invoked from within\n\"eval $script\"\n    (procedure \"dorunq\" line 9)\n    invoked from within\n\"dorunq\"\n    (\"after\" script)\n\nSigned-off-by: Michele Ballabio <barra_cuda@katamail.com>\n---\n\nI don't know if this patch is the right fix, so here is a script\nthat triggers this error:\n\n--->8---\n#!/bin/sh\n\nrm -rf .git\ngit init\ntouch initial\ngit add initial\ngit commit initial -m \"initial\"\n\ngit checkout -b m-master\n\nsleep 1\ntouch one\ngit add one\ngit commit one -m \"one\"\nsleep 1\ntouch two\ngit add two\ngit commit two -m \"two\"\nsleep 1\ntouch three\ngit add three\ngit commit three -m \"three\"\n\nsleep 1\necho \"Now reorder the commits as:\"\necho \"pick three\"\necho \"pick one\"\necho \"pick two\"\nread\ngit rebase -i master\n\ngit checkout -b m-reload master\n\nsleep 1\ntouch four\ngit add four\ngit commit four -m \"four\"\nsleep 1\ntouch five\ngit add five\ngit commit five -m \"five\"\n\ngit checkout m-master\n\ngitk --all\n# within gitk, reload: it should give an error.\n# if it does not error out, checkout another branch and try\n# to reload again.\n---8<---\n\n gitk |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 9ab6dba..041345d 100755\n--- a/gitk\n+++ b/gitk\n@@ -5827,7 +5827,8 @@ proc dispnexttag {} {\n proc make_secsel {l} {\n     global linehtag linentag linedtag canv canv2 canv3\n \n-    if {![info exists linehtag($l)]} return\n+    if {![info exists linehtag($l)] ||\n+\t[llength [$canv bbox $linehtag($l)]] ne 4 } return\n     $canv delete secsel\n     set t [eval $canv create rect [$canv bbox $linehtag($l)] -outline {{}} \\\n \t       -tags secsel -fill [$canv cget -selectbackground]]\n-- \n1.5.5.1\n"},{"id":"77243","messageId":"18480.49438.10215.276463@cargo.ozlabs.ibm.com","threadId":"13558","inReplyTo":"200805172255.52828.barra_cuda@katamail.com","subject":"Re: [PATCH] gitk: avoid error on reload","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2008-05-18T23:51:58Z","receivedAt":"2008-05-18T23:51:58Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Michele Ballabio writes:\n\n> I don't know if this patch is the right fix, so here is a script\n> that triggers this error:\n\nMany thanks for finding a way to trigger this bug reliably.  I have\nbeen chasing it for a while but haven't been able to trigger it\nrepeatably before this.  The actual bug was that I wasn't unsetting\nline[hnd]tag when clearing the canvases.  I have checked in a fix.\n\nPaul.\n"}]}