{"thread":{"id":"34813","subject":"[PATCH] gitk: fix race error at click while reading commits","startedAt":"2013-08-30T23:39:38Z","lastAt":"2013-08-30T23:39:38Z","messageCount":1,"participants":["Max Kirillov"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"226383","messageId":"20130830233938.GA10148@wheezy.local","threadId":"34813","inReplyTo":null,"subject":"[PATCH] gitk: fix race error at click while reading commits","fromName":"Max Kirillov","fromEmail":"max@max630.net","sentAt":"2013-08-30T23:39:38Z","receivedAt":"2013-08-30T23:39:38Z","isPatch":true,"sender":{"key":"max@max630.net","avatar":"https://avatars.githubusercontent.com/u/381560?v=4"},"body":"If I click the commit list while reading (or rereading, by Shift-F5)\ncommits, sometimes an error message appears:\n`can't read \"pending_select\": no such variable',\nbecause pending_select is reset during update.\n\nJust removing update or saving value in local variable would result in\noccasional scrolling to some random commit in history, often very far\nfrom the beginning. So nicer choice is skip the selection if change is\ndetected\n\nSigned-off-by: Max Kirillov <max@max630.net>\n---\n gitk-git/gitk | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex b3706fc..5a8a57c 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -5038,8 +5038,11 @@ proc layoutmore {} {\n     }\n     if {[info exists pending_select] &&\n \t[commitinview $pending_select $curview]} {\n+\tset save_pending_select $pending_select\n \tupdate\n-\tselectline [rowofcommit $pending_select] 1\n+\tif {[info exists pending_select] && $pending_select == $save_pending_select} {\n+\t    selectline [rowofcommit $save_pending_select] 1\n+\t}\n     }\n     drawvisible\n }\n-- \n1.8.4.rc3.902.g80a4b9e\n"}]}