Skip to content

Commit

Permalink
patch 8.2.3884: crash when clearing the argument list while using it
Browse files Browse the repository at this point in the history
Problem:    Crash when clearing the argument list while using it.
Solution:   Lock the argument list for ":all".
  • Loading branch information
brammool committed Dec 24, 2021
1 parent 5937c75 commit 6f98371
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/arglist.c
Expand Up @@ -910,6 +910,7 @@ do_arg_all(
tabpage_T *old_curtab, *last_curtab;
win_T *new_curwin = NULL;
tabpage_T *new_curtab = NULL;
int prev_arglist_locked = arglist_locked;

#ifdef FEAT_CMDWIN
if (cmdwin_type != 0)
Expand All @@ -936,6 +937,7 @@ do_arg_all(
// watch out for its size to be changed.
alist = curwin->w_alist;
++alist->al_refcount;
arglist_locked = TRUE;

old_curwin = curwin;
old_curtab = curtab;
Expand Down Expand Up @@ -1155,6 +1157,7 @@ do_arg_all(

// Remove the "lock" on the argument list.
alist_unlink(alist);
arglist_locked = prev_arglist_locked;

--autocmd_no_enter;

Expand Down
7 changes: 7 additions & 0 deletions src/testdir/test_arglist.vim
Expand Up @@ -583,4 +583,11 @@ func Test_all_not_allowed_from_cmdwin()
au! BufEnter
endfunc

func Test_clear_arglist_in_all()
n 0 00 000 0000 00000 000000
au! * 0 n 0
all
au! *
endfunc

" vim: shiftwidth=2 sts=2 expandtab
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -749,6 +749,8 @@ static char *(features[]) =

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

0 comments on commit 6f98371

Please sign in to comment.