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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]