summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 57cae87)
raw | patch | inline | side by side (parent: 57cae87)
author | Alexander Gavrilov <angavrilov@gmail.com> | |
Wed, 16 Jul 2008 20:48:08 +0000 (00:48 +0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Thu, 17 Jul 2008 02:09:28 +0000 (22:09 -0400) |
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>
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>
git-gui.sh | patch | blob | history | |
lib/blame.tcl | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index b1ed0ec5681ea78fb5ece8393604760fb302214f..83e2645714e11ab783144bb8dc71a968502640d1 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
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'"
diff --git a/lib/blame.tcl b/lib/blame.tcl
index 192505d983030c04f2153de9ac33709663fca7f1..2c190482df10dafb9bcef8116ea42c931d553efb 100644 (file)
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
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