mirror of
https://github.com/neovim/neovim.git
synced 2026-07-16 14:11:28 +00:00
vim-patch:8.2.2473: crash when leaving command line window triggers autocommand
Problem: Crash when leaving command line window triggers autocommand.
(houyunsong)
Solution: Make sure not to close the current window or buffer.
8c6951fa28
N/A patches for version.c:
vim-patch:8.2.2414: using freed memory when closing the cmdline window
Problem: Using freed memory when closing the cmdline window.
Solution: Check the window is still valid.
b7e2670b6a
This commit is contained in:
@@ -6635,11 +6635,13 @@ static int open_cmdwin(void)
|
||||
wp = curwin;
|
||||
set_bufref(&bufref, curbuf);
|
||||
win_goto(old_curwin);
|
||||
win_close(wp, true);
|
||||
if (win_valid(wp) && wp != curwin) {
|
||||
win_close(wp, true);
|
||||
}
|
||||
|
||||
// win_close() may have already wiped the buffer when 'bh' is
|
||||
// set to 'wipe'.
|
||||
if (bufref_valid(&bufref)) {
|
||||
// set to 'wipe', autocommands may have closed other windows
|
||||
if (bufref_valid(&bufref) && bufref.br_buf != curbuf) {
|
||||
close_buffer(NULL, bufref.br_buf, DOBUF_WIPE, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -2000,4 +2000,13 @@ func Test_autocmd_closes_window()
|
||||
au! BufWinLeave
|
||||
endfunc
|
||||
|
||||
func Test_autocmd_closing_cmdwin()
|
||||
au BufWinLeave * nested q
|
||||
call assert_fails("norm 7q?\n", 'E855:')
|
||||
|
||||
au! BufWinLeave
|
||||
new
|
||||
only
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
Reference in New Issue
Block a user