mirror of
https://github.com/neovim/neovim.git
synced 2025-11-23 18:46:38 +00:00
vim-patch:8.1.0073: crash when autocommands call setloclist()
Problem: Crash when autocommands call setloclist(). (Dominique Pelle)
Solution: If the quickfix list changes then don't jump to the error.
0366c0161e
This commit is contained in:
@@ -5368,8 +5368,11 @@ void ex_cexpr(exarg_T *eap)
|
|||||||
apply_autocmds(EVENT_QUICKFIXCMDPOST, (char_u *)au_name,
|
apply_autocmds(EVENT_QUICKFIXCMDPOST, (char_u *)au_name,
|
||||||
curbuf->b_fname, true, curbuf);
|
curbuf->b_fname, true, curbuf);
|
||||||
}
|
}
|
||||||
if (res > 0 && (eap->cmdidx == CMD_cexpr || eap->cmdidx == CMD_lexpr)) {
|
if (res > 0
|
||||||
qf_jump(qi, 0, 0, eap->forceit); // display first error
|
&& (eap->cmdidx == CMD_cexpr || eap->cmdidx == CMD_lexpr)
|
||||||
|
&& qi == ll_get_or_alloc_list(curwin)) {
|
||||||
|
// Jump to the first error if autocmds didn't free the list.
|
||||||
|
qf_jump(qi, 0, 0, eap->forceit);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
EMSG(_("E777: String or List expected"));
|
EMSG(_("E777: String or List expected"));
|
||||||
|
|||||||
@@ -3373,6 +3373,17 @@ func Test_lbuffer_with_bwipe()
|
|||||||
augroup END
|
augroup END
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_setloclist_in_aucmd()
|
||||||
|
" This was using freed memory.
|
||||||
|
augroup nasty
|
||||||
|
au * * call setloclist(0, [], 'f')
|
||||||
|
augroup END
|
||||||
|
lexpr "x"
|
||||||
|
augroup nasty
|
||||||
|
au!
|
||||||
|
augroup END
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Tests for the "CTRL-W <CR>" command.
|
" Tests for the "CTRL-W <CR>" command.
|
||||||
func Xview_result_split_tests(cchar)
|
func Xview_result_split_tests(cchar)
|
||||||
call s:setup_commands(a:cchar)
|
call s:setup_commands(a:cchar)
|
||||||
|
|||||||
Reference in New Issue
Block a user