mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
vim-patch:8.2.3097: crash when using "quit" at recovery prompt
Problem: Crash when using "quit" at recovery prompt and autocommands are
triggered.
Solution: Block autocommands when creating an empty buffer to use as the
current buffer. (closes vim/vim#8506)
1d97efce0c
This commit is contained in:
@@ -901,7 +901,10 @@ void handle_swap_exists(bufref_T *old_curbuf)
|
|||||||
if (old_curbuf == NULL
|
if (old_curbuf == NULL
|
||||||
|| !bufref_valid(old_curbuf)
|
|| !bufref_valid(old_curbuf)
|
||||||
|| old_curbuf->br_buf == curbuf) {
|
|| old_curbuf->br_buf == curbuf) {
|
||||||
|
// Block autocommands here because curwin->w_buffer is NULL.
|
||||||
|
block_autocmds();
|
||||||
buf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED);
|
buf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED);
|
||||||
|
unblock_autocmds();
|
||||||
} else {
|
} else {
|
||||||
buf = old_curbuf->br_buf;
|
buf = old_curbuf->br_buf;
|
||||||
}
|
}
|
||||||
|
@@ -319,6 +319,7 @@ func Test_swap_prompt_splitwin()
|
|||||||
let buf = RunVimInTerminal('', {'rows': 20})
|
let buf = RunVimInTerminal('', {'rows': 20})
|
||||||
call term_sendkeys(buf, ":set nomore\n")
|
call term_sendkeys(buf, ":set nomore\n")
|
||||||
call term_sendkeys(buf, ":set noruler\n")
|
call term_sendkeys(buf, ":set noruler\n")
|
||||||
|
|
||||||
call term_sendkeys(buf, ":split Xfile1\n")
|
call term_sendkeys(buf, ":split Xfile1\n")
|
||||||
call term_wait(buf)
|
call term_wait(buf)
|
||||||
call WaitForAssert({-> assert_match('^\[O\]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: $', term_getline(buf, 20))})
|
call WaitForAssert({-> assert_match('^\[O\]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: $', term_getline(buf, 20))})
|
||||||
@@ -330,8 +331,19 @@ func Test_swap_prompt_splitwin()
|
|||||||
call term_wait(buf)
|
call term_wait(buf)
|
||||||
call WaitForAssert({-> assert_match('^1$', term_getline(buf, 20))})
|
call WaitForAssert({-> assert_match('^1$', term_getline(buf, 20))})
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
|
|
||||||
|
" This caused Vim to crash when typing "q".
|
||||||
|
" TODO: it does not actually reproduce the crash.
|
||||||
|
call writefile(['au BufAdd * set virtualedit=all'], 'Xvimrc')
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('-u Xvimrc Xfile1', {'rows': 20, 'wait_for_ruler': 0})
|
||||||
|
call TermWait(buf)
|
||||||
|
call WaitForAssert({-> assert_match('^\[O\]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:', term_getline(buf, 20))})
|
||||||
|
call term_sendkeys(buf, "q")
|
||||||
|
|
||||||
%bwipe!
|
%bwipe!
|
||||||
call delete('Xfile1')
|
call delete('Xfile1')
|
||||||
|
call delete('Xvimrc')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_swap_symlink()
|
func Test_swap_symlink()
|
||||||
|
Reference in New Issue
Block a user