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 <mah@jump-ing.de> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

Markus Hitter committed Nov 7, 2016 at 16:01 UTC 0748f41eb83194dbc310fe47b4948f611ac5b3a2
1 file changed +5
gitk
+5
@@ -8073,7 +8073,11 @@ proc getblobdiffline {bdf ids} {
8073 $ctext conf -state normal
8074 while {[incr nr] <= 1000 && [gets $bdf line] >= 0} {
8075 if {$ids != $diffids || $bdf != $blobdifffd($ids)} {
8076 + # Older diff read. Abort it.
8077 catch {close $bdf}
8078 + if {$ids != $diffids} {
8079 + array unset blobdifffd $ids
8080 + }
8081 return 0
8082 }
8083 parseblobdiffline $ids $line
@@ -8082,6 +8086,7 @@ proc getblobdiffline {bdf ids} {
8086 blobdiffmaybeseehere [eof $bdf]
8087 if {[eof $bdf]} {
8088 catch {close $bdf}
8089 + array unset blobdifffd $ids
8090 return 0
8091 }
8092 return [expr {$nr >= 1000? 2: 1}]