BufWinLeave発生時にquitするとSEGVする #995

Open
norio13 opened this Issue Dec 20, 2016 · 1 comment

Projects

None yet

2 participants

@norio13
norio13 commented Dec 20, 2016

質問・報告の内容

BufWinLeave発生時にquit,hide,bwipeout,bdelete,bunload,closeのいずれかのコマンドを実行するとSEGVしました。

sample.vim

tabedit

augroup sample
    autocmd!
    autocmd BufWinLeave * quit
augroup END

quit

Vim起動

vim -Nu NONE -S sample.vim

Vimのバージョン

8.0.134

OSの種類/ディストリ/バージョン

  • Linux Debian 8.6 jessie 64bit
@h-east
Member
h-east commented Dec 20, 2016

これで落ちなくなるけど、編集したバッファでも確認なしに閉じてしまいますなぁ。週末検討します。

diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 2b0f15e..da5b2b0 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -7248,6 +7248,11 @@ ex_quit(exarg_T *eap)
 # endif
 	/* close window; may free buffer */
 	win_close(wp, !P_HID(wp->w_buffer) || eap->forceit);
+# ifdef FEAT_AUTOCMD
+	/* an autocommand may have deleted the buffer */
+	if (only_one_window() && (ONE_WINDOW || eap->addr_count == 0))
+	    getout(0);
+# endif
 #endif
     }
 }
@h-east h-east self-assigned this Dec 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment