All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Kirillov <max@max630.net>
To: Paul Mackerras <paulus@ozlabs.org>, Markus Hitter <mah@jump-ing.de>
Cc: Max Kirillov <max@max630.net>, git@vger.kernel.org
Subject: [PATCH] gitk: fix fatal error by dropping duplicated requests
Date: Wed,  4 Mar 2020 00:39:07 +0200	[thread overview]
Message-ID: <20200303223907.5308-1-max@max630.net> (raw)

During fast UI actions there may happen a fatal error message due to undefined
$blobdifffd($ids). It happens because 2 same requests happen to be started.
Then first one to complete wipes the $ids from blobdifffd, causing the second
to fail. Then no diff is displayed in that gitk process anymore, so it has
to be restarted. To reproduce one could fast click a big commit line twice, for
example, but I believe it is not the only case.

Fix by not starting a request if there is already one with the same $ids.
It does not seem to cause any malfunctioning when triggered.

Signed-off-by: Max Kirillov <max@max630.net>
---
 gitk | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gitk b/gitk
index da84e22dd4..3919ba85b1 100755
--- a/gitk
+++ b/gitk
@@ -8009,6 +8009,10 @@ proc getblobdiffs {ids} {
     global limitdiffs vfilelimit curview
     global git_version
 
+    if {[info exists blobdifffd($ids)]} {
+	return
+    }
+
     set textconv {}
     if {[package vcompare $git_version "1.6.1"] >= 0} {
 	set textconv "--textconv"
@@ -9145,6 +9149,11 @@ proc do_cmp_commits {a b} {
 proc diffcommits {a b} {
     global diffcontext diffids blobdifffd diffinhdr currdiffsubmod
 
+    set diffids [list commits $a $b]
+    if {[info exists blobdifffd($diffids)]} {
+	return
+    }
+
     set tmpdir [gitknewtmpdir]
     set fna [file join $tmpdir "commit-[string range $a 0 7]"]
     set fnb [file join $tmpdir "commit-[string range $b 0 7]"]
@@ -9161,7 +9170,6 @@ proc diffcommits {a b} {
 	error_popup [mc "Error diffing commits: %s" $err]
 	return
     }
-    set diffids [list commits $a $b]
     set blobdifffd($diffids) $fd
     set diffinhdr 0
     set currdiffsubmod ""
-- 
2.19.0.1202.g68e1e8f04e


                 reply	other threads:[~2020-03-03 22:46 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=20200303223907.5308-1-max@max630.net \
    --to=max@max630.net \
    --cc=git@vger.kernel.org \
    --cc=mah@jump-ing.de \
    --cc=paulus@ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.