Mercurial > vim
diff src/testdir/test_timers.vim @ 20709:a2262c80a4e0 v8.2.0908
patch 8.2.0908: crash when changing the function table while listing it
Commit: https://github.com/vim/vim/commit/3fffa97159a427067b60c80ed4645e168cc5c4bd
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jun 5 21:06:10 2020 +0200
patch 8.2.0908: crash when changing the function table while listing it
Problem: Crash when changing the function table while listing it.
Solution: Bail out when the function table changes. (closes https://github.com/vim/vim/issues/6209)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 05 Jun 2020 21:15:04 +0200 |
parents | 116c7bd5e980 |
children | ff21e2962490 |
line wrap: on
line diff
--- a/src/testdir/test_timers.vim +++ b/src/testdir/test_timers.vim @@ -3,6 +3,7 @@ source check.vim CheckFeature timers +source screendump.vim source shared.vim source term_util.vim @@ -424,4 +425,28 @@ func Test_timer_invalid_callback() call assert_fails('call timer_start(0, "0")', 'E921') endfunc +func Test_timer_changing_function_list() + CheckRunVimInTerminal + + " Create a large number of functions. Should get the "more" prompt. + " The typing "G" triggers the timer, which changes the function table. + let lines =<< trim END + for func in map(range(1,99), "'Func' .. v:val") + exe "func " .. func .. "()" + endfunc + endfor + au CmdlineLeave : call timer_start(0, {-> 0}) + END + call writefile(lines, 'XTest_timerchange') + let buf = RunVimInTerminal('-S XTest_timerchange', #{rows: 10}) + call term_sendkeys(buf, ":fu\<CR>") + call WaitForAssert({-> assert_match('-- More --', term_getline(buf, 10))}) + call term_sendkeys(buf, "G") + call WaitForAssert({-> assert_match('E454', term_getline(buf, 9))}) + call term_sendkeys(buf, "\<Esc>") + + call StopVimInTerminal(buf) + call delete('XTest_timerchange') +endfunc + " vim: shiftwidth=2 sts=2 expandtab