mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 16:58:17 +00:00
vim-patch:8.0.1750: crash clearing location list #9968
Problem: Crash when clearing loccation list in autocommand.
Solution: Check if "qi" equals "ql_info". (Yegappan Lakshmanan)
3b9474b4ad
This commit is contained in:
@@ -5399,9 +5399,6 @@ void ex_helpgrep(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Autocommands may change the list. Save it for later comparison
|
|
||||||
qf_info_T *save_qi = qi;
|
|
||||||
|
|
||||||
regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING);
|
regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING);
|
||||||
regmatch.rm_ic = FALSE;
|
regmatch.rm_ic = FALSE;
|
||||||
if (regmatch.regprog != NULL) {
|
if (regmatch.regprog != NULL) {
|
||||||
@@ -5499,7 +5496,7 @@ void ex_helpgrep(exarg_T *eap)
|
|||||||
if (au_name != NULL) {
|
if (au_name != NULL) {
|
||||||
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
||||||
curbuf->b_fname, true, curbuf);
|
curbuf->b_fname, true, curbuf);
|
||||||
if (!new_qi && qi != save_qi && qf_find_buf(qi) == NULL) {
|
if (!new_qi && qi != &ql_info && qf_find_buf(qi) == NULL) {
|
||||||
// autocommands made "qi" invalid
|
// autocommands made "qi" invalid
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -2862,13 +2862,13 @@ func Test_qftitle()
|
|||||||
" :cgetexpr
|
" :cgetexpr
|
||||||
exe "cgetexpr readfile('Xerr')"
|
exe "cgetexpr readfile('Xerr')"
|
||||||
call assert_equal(":cgetexpr readfile('Xerr')",
|
call assert_equal(":cgetexpr readfile('Xerr')",
|
||||||
\ getqflist({'title' : 1}).title)
|
\ getqflist({'title' : 1}).title)
|
||||||
|
|
||||||
" :caddexpr
|
" :caddexpr
|
||||||
call setqflist([], 'f')
|
call setqflist([], 'f')
|
||||||
exe "caddexpr readfile('Xerr')"
|
exe "caddexpr readfile('Xerr')"
|
||||||
call assert_equal(":caddexpr readfile('Xerr')",
|
call assert_equal(":caddexpr readfile('Xerr')",
|
||||||
\ getqflist({'title' : 1}).title)
|
\ getqflist({'title' : 1}).title)
|
||||||
|
|
||||||
" :cbuffer
|
" :cbuffer
|
||||||
new Xerr
|
new Xerr
|
||||||
@@ -2968,6 +2968,20 @@ func Test_qfwin_pos()
|
|||||||
close
|
close
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" The following test used to crash Vim
|
||||||
|
func Test_lhelpgrep_autocmd()
|
||||||
|
lhelpgrep quickfix
|
||||||
|
autocmd QuickFixCmdPost * call setloclist(0, [], 'f')
|
||||||
|
lhelpgrep buffer
|
||||||
|
call assert_equal('help', &filetype)
|
||||||
|
call assert_equal(0, getloclist(0, {'nr' : '$'}).nr)
|
||||||
|
lhelpgrep tabpage
|
||||||
|
call assert_equal('help', &filetype)
|
||||||
|
call assert_equal(1, getloclist(0, {'nr' : '$'}).nr)
|
||||||
|
au! QuickFixCmdPost
|
||||||
|
new | only
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Test to make sure that an empty quickfix buffer is not reused for loading
|
" Test to make sure that an empty quickfix buffer is not reused for loading
|
||||||
" a normal buffer.
|
" a normal buffer.
|
||||||
func Test_empty_qfbuf()
|
func Test_empty_qfbuf()
|
||||||
|
Reference in New Issue
Block a user