Browse Source

gitk: Kill back-end processes on window close

When collecting commits for a rarely changed, or recently
created file or directory, rev-list may work for a noticeable
period of time without producing any output.  Such processes
don't receive SIGPIPE for a while after gitk is closed, thus
becoming runaway CPU hogs.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
maint
Alexander Gavrilov 17 years ago committed by Paul Mackerras
parent
commit
e2f90ee45c
  1. 21
      gitk

21
gitk

@ -375,10 +375,9 @@ proc start_rev_list {view} {
return 1 return 1
} }


proc stop_rev_list {view} { proc stop_instance {inst} {
global commfd viewinstances leftover global commfd leftover


foreach inst $viewinstances($view) {
set fd $commfd($inst) set fd $commfd($inst)
catch { catch {
set pid [pid $fd] set pid [pid $fd]
@ -389,6 +388,21 @@ proc stop_rev_list {view} {
unset commfd($inst) unset commfd($inst)
unset leftover($inst) unset leftover($inst)
} }

proc stop_backends {} {
global commfd

foreach inst [array names commfd] {
stop_instance $inst
}
}

proc stop_rev_list {view} {
global viewinstances

foreach inst $viewinstances($view) {
stop_instance $inst
}
set viewinstances($view) {} set viewinstances($view) {}
} }


@ -2103,6 +2117,7 @@ proc makewindow {} {
bind . <$M1B-minus> {incrfont -1} bind . <$M1B-minus> {incrfont -1}
bind . <$M1B-KP_Subtract> {incrfont -1} bind . <$M1B-KP_Subtract> {incrfont -1}
wm protocol . WM_DELETE_WINDOW doquit wm protocol . WM_DELETE_WINDOW doquit
bind . <Destroy> {stop_backends}
bind . <Button-1> "click %W" bind . <Button-1> "click %W"
bind $fstring <Key-Return> {dofind 1 1} bind $fstring <Key-Return> {dofind 1 1}
bind $sha1entry <Key-Return> gotocommit bind $sha1entry <Key-Return> gotocommit

Loading…
Cancel
Save