Skip to content

Commit 5440eb0

Browse files
prati0100gitster
authored andcommitted
git-gui: call do_quit before destroying the main window
If the toplevel window for the window being destroyed is the main window (aka "."), then simply destroying it means the cleanup tasks are not executed (like saving the commit message buffer, saving window state, etc.) All this is handled by do_quit. Call it instead of directly destroying the main window. For other toplevel windows, the old behavior remains. Signed-off-by: Pratyush Yadav <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5ab7227 commit 5440eb0

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

git-gui.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3006,8 +3006,23 @@ unset doc_path doc_url
30063006
wm protocol . WM_DELETE_WINDOW do_quit
30073007
bind all <$M1B-Key-q> do_quit
30083008
bind all <$M1B-Key-Q> do_quit
3009-
bind all <$M1B-Key-w> {destroy [winfo toplevel %W]}
3010-
bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
3009+
3010+
set m1b_w_script {
3011+
set toplvl_win [winfo toplevel %W]
3012+
3013+
# If we are destroying the main window, we should call do_quit to take
3014+
# care of cleanup before exiting the program.
3015+
if {$toplvl_win eq "."} {
3016+
do_quit
3017+
} else {
3018+
destroy $toplvl_win
3019+
}
3020+
}
3021+
3022+
bind all <$M1B-Key-w> $m1b_w_script
3023+
bind all <$M1B-Key-W> $m1b_w_script
3024+
3025+
unset m1b_w_script
30113026
30123027
set subcommand_args {}
30133028
proc usage {} {

0 commit comments

Comments
 (0)