Mercurial > vim
comparison src/testdir/test_autocmd.vim @ 31231:684e6dfa2fba v9.0.0949
patch 9.0.0949: crash when unletting a variable while listing variables
Commit: https://github.com/vim/vim/commit/ef2c325f5e3c437b722bb96bf369ba2a5c541163
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Nov 25 16:31:51 2022 +0000
patch 9.0.0949: crash when unletting a variable while listing variables
Problem: Crash when unletting a variable while listing variables.
Solution: Disallow changing a hashtable while going over the entries.
(closes #11435)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 25 Nov 2022 17:45:04 +0100 |
parents | a86ee6c0309e |
children | d8e7d725a666 |
comparison
equal
deleted
inserted
replaced
31230:e93800d75da2 | 31231:684e6dfa2fba |
---|---|
2320 | 2320 |
2321 " this was using freed memory | 2321 " this was using freed memory |
2322 call term_sendkeys(buf, ":autocmd User\<CR>") | 2322 call term_sendkeys(buf, ":autocmd User\<CR>") |
2323 call TermWait(buf, 50) | 2323 call TermWait(buf, 50) |
2324 call term_sendkeys(buf, "G") | 2324 call term_sendkeys(buf, "G") |
2325 | |
2326 call StopVimInTerminal(buf) | |
2327 endfunc | |
2328 | |
2329 func Test_autocmd_CmdlineLeave_unlet() | |
2330 CheckRunVimInTerminal | |
2331 | |
2332 let lines =<< trim END | |
2333 for i in range(1, 999) | |
2334 exe 'let g:var' .. i '=' i | |
2335 endfor | |
2336 au CmdlineLeave : call timer_start(0, {-> execute('unlet g:var990')}) | |
2337 END | |
2338 call writefile(lines, 'XleaveUnlet', 'D') | |
2339 let buf = RunVimInTerminal('-S XleaveUnlet', {'rows': 10}) | |
2340 | |
2341 " this was using freed memory | |
2342 call term_sendkeys(buf, ":let g:\<CR>") | |
2343 call TermWait(buf, 50) | |
2344 call term_sendkeys(buf, "G") | |
2345 call TermWait(buf, 50) | |
2346 call term_sendkeys(buf, "\<CR>") " for the hit-enter prompt | |
2325 | 2347 |
2326 call StopVimInTerminal(buf) | 2348 call StopVimInTerminal(buf) |
2327 endfunc | 2349 endfunc |
2328 | 2350 |
2329 function s:Before_test_dirchanged() | 2351 function s:Before_test_dirchanged() |