diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-11-25 16:31:51 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-11-25 16:31:51 +0000 |
commit | ef2c325f5e3c437b722bb96bf369ba2a5c541163 (patch) | |
tree | dc85f0dc98dce1937b459d8d3882473f25db03c3 /src/testdir | |
parent | c1cf4c91072f91b6b8dd636627a4ddf6f4b21f16 (diff) |
patch 9.0.0949: crash when unletting a variable while listing variablesv9.0.0949
Problem: Crash when unletting a variable while listing variables.
Solution: Disallow changing a hashtable while going over the entries.
(closes #11435)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_autocmd.vim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index aa204c4f37..a0d83ecf35 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -2326,6 +2326,28 @@ func Test_autocmd_user_clear_group() call StopVimInTerminal(buf) endfunc +func Test_autocmd_CmdlineLeave_unlet() + CheckRunVimInTerminal + + let lines =<< trim END + for i in range(1, 999) + exe 'let g:var' .. i '=' i + endfor + au CmdlineLeave : call timer_start(0, {-> execute('unlet g:var990')}) + END + call writefile(lines, 'XleaveUnlet', 'D') + let buf = RunVimInTerminal('-S XleaveUnlet', {'rows': 10}) + + " this was using freed memory + call term_sendkeys(buf, ":let g:\<CR>") + call TermWait(buf, 50) + call term_sendkeys(buf, "G") + call TermWait(buf, 50) + call term_sendkeys(buf, "\<CR>") " for the hit-enter prompt + + call StopVimInTerminal(buf) +endfunc + function s:Before_test_dirchanged() augroup test_dirchanged autocmd! |