git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Max Kirillov <max@max630.net>
To: Paul Mackerras <paulus@samba.org>
Cc: git@vger.kernel.org
Subject: [PATCH] gitk: fix race error at click while reading commits
Date: Sat, 31 Aug 2013 02:39:38 +0300	[thread overview]
Message-ID: <20130830233938.GA10148@wheezy.local> (raw)

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

                 reply	other threads:[~2013-08-30 23:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130830233938.GA10148@wheezy.local \
    --to=max@max630.net \
    --cc=git@vger.kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).