diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-11-13 21:10:02 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-11-13 21:10:02 +0000 |
commit | 920d311480114274e4d73156edf4b49ba0b712dd (patch) | |
tree | 9a1026423d747cf21904a03a6adde768ca8e1ed4 /src/testdir/test_menu.vim | |
parent | bf533e4e88ebac8b8fec6d3e12dadc476ce9a1df (diff) |
patch 9.0.0874: using freed memory when executing unmenu at more promptv9.0.0874
Problem: Using freed memory when executing unmenu at the more prompt.
Solution: Do not clear menus while listing them. (closes #11439)
Diffstat (limited to 'src/testdir/test_menu.vim')
-rw-r--r-- | src/testdir/test_menu.vim | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/testdir/test_menu.vim b/src/testdir/test_menu.vim index 95d2b01a5c..65bdac2373 100644 --- a/src/testdir/test_menu.vim +++ b/src/testdir/test_menu.vim @@ -3,6 +3,8 @@ source check.vim CheckFeature menu +source screendump.vim + func Test_load_menu() try source $VIMRUNTIME/menu.vim @@ -568,4 +570,28 @@ func Test_only_modifier() tunmenu a.b endfunc +func Test_mapclear_while_listing() + CheckRunVimInTerminal + + let lines =<< trim END + set nocompatible + unmenu * + for i in range(1, 999) + exe 'menu ' .. 'foo.' .. i .. ' bar' + endfor + au CmdlineLeave : call timer_start(0, {-> execute('unmenu *')}) + END + call writefile(lines, 'Xmenuclear', 'D') + let buf = RunVimInTerminal('-S Xmenuclear', {'rows': 10}) + + " this was using freed memory + call term_sendkeys(buf, ":menu\<CR>") + call TermWait(buf, 50) + call term_sendkeys(buf, "G") + call TermWait(buf, 50) + call term_sendkeys(buf, "\<CR>") + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab |