mirror of
https://github.com/neovim/neovim.git
synced 2025-10-14 05:46:12 +00:00
vim-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".
6f98371532
This commit is contained in:
@@ -818,6 +818,7 @@ static void do_arg_all(int count, int forceit, int keep_tabs)
|
|||||||
tabpage_T *old_curtab, *last_curtab;
|
tabpage_T *old_curtab, *last_curtab;
|
||||||
win_T *new_curwin = NULL;
|
win_T *new_curwin = NULL;
|
||||||
tabpage_T *new_curtab = NULL;
|
tabpage_T *new_curtab = NULL;
|
||||||
|
bool prev_arglist_locked = arglist_locked;
|
||||||
|
|
||||||
assert(firstwin != NULL); // satisfy coverity
|
assert(firstwin != NULL); // satisfy coverity
|
||||||
|
|
||||||
@@ -839,6 +840,7 @@ static void do_arg_all(int count, int forceit, int keep_tabs)
|
|||||||
// watch out for its size to be changed.
|
// watch out for its size to be changed.
|
||||||
alist = curwin->w_alist;
|
alist = curwin->w_alist;
|
||||||
alist->al_refcount++;
|
alist->al_refcount++;
|
||||||
|
arglist_locked = true;
|
||||||
|
|
||||||
old_curwin = curwin;
|
old_curwin = curwin;
|
||||||
old_curtab = curtab;
|
old_curtab = curtab;
|
||||||
@@ -1034,8 +1036,10 @@ static void do_arg_all(int count, int forceit, int keep_tabs)
|
|||||||
|
|
||||||
// Remove the "lock" on the argument list.
|
// Remove the "lock" on the argument list.
|
||||||
alist_unlink(alist);
|
alist_unlink(alist);
|
||||||
|
arglist_locked = prev_arglist_locked;
|
||||||
|
|
||||||
autocmd_no_enter--;
|
autocmd_no_enter--;
|
||||||
|
|
||||||
// restore last referenced tabpage's curwin
|
// restore last referenced tabpage's curwin
|
||||||
if (last_curtab != new_curtab) {
|
if (last_curtab != new_curtab) {
|
||||||
if (valid_tabpage(last_curtab)) {
|
if (valid_tabpage(last_curtab)) {
|
||||||
|
@@ -607,4 +607,11 @@ func Test_all_not_allowed_from_cmdwin()
|
|||||||
au! BufEnter
|
au! BufEnter
|
||||||
endfunc
|
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
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Reference in New Issue
Block a user