changeset 26711:5860bd619d30 v8.2.3884

patch 8.2.3884: crash when clearing the argument list while using it Commit: https://github.com/vim/vim/commit/6f98371532fcff911b462d51bc64f2ce8a6ae682 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 24 18:11:27 2021 +0000 patch 8.2.3884: crash when clearing the argument list while using it Problem: Crash when clearing the argument list while using it. Solution: Lock the argument list for ":all".
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 Dec 2021 19:15:03 +0100
parents 8fd8af3764e2
children e46c0f3d87a5
files src/arglist.c src/testdir/test_arglist.vim src/version.c
diffstat 3 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/arglist.c
+++ b/src/arglist.c
@@ -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)
@@ -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;
@@ -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;
 
--- a/src/testdir/test_arglist.vim
+++ b/src/testdir/test_arglist.vim
@@ -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
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3884,
+/**/
     3883,
 /**/
     3882,