mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.1.0060: crash when autocommands delete the current buffer
Problem: Crash when autocommands delete the current buffer. (Dominique
Pelle)
Solution: Check that autocommands don't change the buffer.
600323b4ef
This commit is contained in:
parent
7d345a7294
commit
bb4e0deaf9
@ -5255,8 +5255,14 @@ void ex_cbuffer(exarg_T *eap)
|
||||
qf_list_changed(qi, qi->qf_curlist);
|
||||
}
|
||||
if (au_name != NULL) {
|
||||
const buf_T *const curbuf_old = curbuf;
|
||||
apply_autocmds(EVENT_QUICKFIXCMDPOST, (char_u *)au_name,
|
||||
curbuf->b_fname, true, curbuf);
|
||||
if (curbuf != curbuf_old) {
|
||||
// Autocommands changed buffer, don't jump now, "qi" may
|
||||
// be invalid.
|
||||
res = 0;
|
||||
}
|
||||
}
|
||||
if (res > 0 && (eap->cmdidx == CMD_cbuffer
|
||||
|| eap->cmdidx == CMD_lbuffer)) {
|
||||
|
@ -3360,3 +3360,15 @@ func Test_vimgrep_autocmd()
|
||||
call delete('Xtest2.txt')
|
||||
call setqflist([], 'f')
|
||||
endfunc
|
||||
|
||||
func Test_lbuffer_with_bwipe()
|
||||
new
|
||||
new
|
||||
augroup nasty
|
||||
au * * bwipe
|
||||
augroup END
|
||||
lbuffer
|
||||
augroup nasty
|
||||
au!
|
||||
augroup END
|
||||
endfunc
|
||||
|
Loading…
Reference in New Issue
Block a user