Skip to content

Commit a0d74d1

Browse files
committed
Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk: gitk: Allow safely calling nukefile from a run queue handler
2 parents c14c8ce + df75e86 commit a0d74d1

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

gitk-git/gitk

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ proc gitdir {} {
2222
# run before X event handlers, so reading from a fast source can
2323
# make the GUI completely unresponsive.
2424
proc run args {
25-
global isonrunq runq
25+
global isonrunq runq currunq
2626

2727
set script $args
2828
if {[info exists isonrunq($script)]} return
29-
if {$runq eq {}} {
29+
if {$runq eq {} && ![info exists currunq]} {
3030
after idle dorunq
3131
}
3232
lappend runq [list {} $script]
@@ -38,10 +38,10 @@ proc filerun {fd script} {
3838
}
3939

4040
proc filereadable {fd script} {
41-
global runq
41+
global runq currunq
4242

4343
fileevent $fd readable {}
44-
if {$runq eq {}} {
44+
if {$runq eq {} && ![info exists currunq]} {
4545
after idle dorunq
4646
}
4747
lappend runq [list $fd $script]
@@ -60,17 +60,19 @@ proc nukefile {fd} {
6060
}
6161

6262
proc dorunq {} {
63-
global isonrunq runq
63+
global isonrunq runq currunq
6464

6565
set tstart [clock clicks -milliseconds]
6666
set t0 $tstart
6767
while {[llength $runq] > 0} {
6868
set fd [lindex $runq 0 0]
6969
set script [lindex $runq 0 1]
70+
set currunq [lindex $runq 0]
71+
set runq [lrange $runq 1 end]
7072
set repeat [eval $script]
73+
unset currunq
7174
set t1 [clock clicks -milliseconds]
7275
set t [expr {$t1 - $t0}]
73-
set runq [lrange $runq 1 end]
7476
if {$repeat ne {} && $repeat} {
7577
if {$fd eq {} || $repeat == 2} {
7678
# script returns 1 if it wants to be readded

0 commit comments

Comments
 (0)