Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brammool committed Jun 18, 2018
1 parent dcdeaaf commit 0366c01
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/quickfix.c
Expand Up @@ -6348,9 +6348,11 @@ ex_cexpr(exarg_T *eap)
if (au_name != NULL)
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
curbuf->b_fname, TRUE, curbuf);
if (res > 0 && (eap->cmdidx == CMD_cexpr ||
eap->cmdidx == CMD_lexpr))
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
if (res > 0 && (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
EMSG(_("E777: String or List expected"));
Expand Down
11 changes: 11 additions & 0 deletions src/testdir/test_quickfix.vim
Expand Up @@ -3362,3 +3362,14 @@ func Test_lbuffer_with_bwipe()
au!
augroup END
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
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -761,6 +761,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
73,
/**/
72,
/**/
Expand Down

0 comments on commit 0366c01

Please sign in to comment.