Skip to content

Commit 0748f41

Browse files
Traumflugpaulusmack
authored andcommitted
gitk: Remove closed file descriptors from $blobdifffd
One shouldn't have descriptors of already closed files around. The first idea to deal with this (previously) ever growing array was to remove it entirely, but it's needed to detect start of a new diff with ths old diff not yet done. This happens when a user clicks on the same commit in the commit list repeatedly without delay. Signed-off-by: Markus Hitter <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 106a6d9 commit 0748f41

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gitk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8073,7 +8073,11 @@ proc getblobdiffline {bdf ids} {
80738073
$ctext conf -state normal
80748074
while {[incr nr] <= 1000 && [gets $bdf line] >= 0} {
80758075
if {$ids != $diffids || $bdf != $blobdifffd($ids)} {
8076+
# Older diff read. Abort it.
80768077
catch {close $bdf}
8078+
if {$ids != $diffids} {
8079+
array unset blobdifffd $ids
8080+
}
80778081
return 0
80788082
}
80798083
parseblobdiffline $ids $line
@@ -8082,6 +8086,7 @@ proc getblobdiffline {bdf ids} {
80828086
blobdiffmaybeseehere [eof $bdf]
80838087
if {[eof $bdf]} {
80848088
catch {close $bdf}
8089+
array unset blobdifffd $ids
80858090
return 0
80868091
}
80878092
return [expr {$nr >= 1000? 2: 1}]

0 commit comments

Comments
 (0)