зеркало из https://github.com/microsoft/git.git
Kill the blame back-end on window close.
Currently 'git-gui blame' does not kill its back-end process, hoping that it will die anyway when the pipe is closed. However, in some cases the process works for a long time without producing any output. This behavior results in a runaway CPU hog. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Родитель
57cae87b77
Коммит
e6131d30c2
14
git-gui.sh
14
git-gui.sh
|
@ -497,6 +497,20 @@ proc githook_read {hook_name args} {
|
|||
return {}
|
||||
}
|
||||
|
||||
proc kill_file_process {fd} {
|
||||
set process [pid $fd]
|
||||
|
||||
catch {
|
||||
if {[is_Windows]} {
|
||||
# Use a Cygwin-specific flag to allow killing
|
||||
# native Windows processes
|
||||
exec kill -f $process
|
||||
} else {
|
||||
exec kill $process
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc sq {value} {
|
||||
regsub -all ' $value "'\\''" value
|
||||
return "'$value'"
|
||||
|
|
|
@ -326,19 +326,27 @@ constructor new {i_commit i_path} {
|
|||
bind $w.file_pane <Configure> \
|
||||
"if {{$w.file_pane} eq {%W}} {[cb _resize %h]}"
|
||||
|
||||
wm protocol $top WM_DELETE_WINDOW "destroy $top"
|
||||
bind $top <Destroy> [cb _kill]
|
||||
|
||||
_load $this {}
|
||||
}
|
||||
|
||||
method _kill {} {
|
||||
if {$current_fd ne {}} {
|
||||
kill_file_process $current_fd
|
||||
catch {close $current_fd}
|
||||
set current_fd {}
|
||||
}
|
||||
}
|
||||
|
||||
method _load {jump} {
|
||||
variable group_colors
|
||||
|
||||
_hide_tooltip $this
|
||||
|
||||
if {$total_lines != 0 || $current_fd ne {}} {
|
||||
if {$current_fd ne {}} {
|
||||
catch {close $current_fd}
|
||||
set current_fd {}
|
||||
}
|
||||
_kill $this
|
||||
|
||||
foreach i $w_columns {
|
||||
$i conf -state normal
|
||||
|
|
Загрузка…
Ссылка в новой задаче