git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk: fix race error at click while reading commits

From
Max Kirillov <max@max630.net>
Date
Aug 30, 2013, 23:39 UTC
Message-ID
<20130830233938.GA10148@wheezy.local>

If I click the commit list while reading (or rereading, by Shift-F5) commits, sometimes an error message appears: `can't read "pending_select": no such variable', because pending_select is reset during update.

Just removing update or saving value in local variable would result in occasional scrolling to some random commit in history, often very far from the beginning. So nicer choice is skip the selection if change is detected

Signed-off-by: Max Kirillov <max@max630.net>
---
 gitk-git/gitk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index b3706fc..5a8a57c 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -5038,8 +5038,11 @@ proc layoutmore {} {
     }
     if {[info exists pending_select] &&
 	[commitinview $pending_select $curview]} {
+	set save_pending_select $pending_select
 	update
-	selectline [rowofcommit $pending_select] 1
+	if {[info exists pending_select] && $pending_select == $save_pending_select} {
+	    selectline [rowofcommit $save_pending_select] 1
+	}
     }
     drawvisible
 }
-- 
1.8.4.rc3.902.g80a4b9e
Message 1 of 1 in “gitk: fix race error at click while reading commits”
  1. gitk: fix race error at click while reading commitsMax Kirillov, Aug 30, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.