diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-03-11 14:19:58 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-03-11 14:19:58 +0100 |
commit | cee52204ca030ce7814844e4dab8b4ed897ba3cc (patch) | |
tree | ecaed340ef62e0b346a7592cc5876f31e1b77f14 /src/testdir/test_terminal.vim | |
parent | e49b4bb89505fad28cf89f0891aef3e2d397919e (diff) | |
download | vim-git-cee52204ca030ce7814844e4dab8b4ed897ba3cc.tar.gz |
patch 8.2.0371: crash with combination of terminal popup and autocmdv8.2.0371
Problem: Crash with combination of terminal popup and autocmd.
Solution: Disallow closing a popup that is the current window. Add a check
that the current buffer is valid. (closes #5754)
Diffstat (limited to 'src/testdir/test_terminal.vim')
-rw-r--r-- | src/testdir/test_terminal.vim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 8cbd6a665..7bdabb892 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -2430,3 +2430,27 @@ func Test_hidden_terminal() call assert_equal('', bufname('^$')) call StopShellInTerminal(buf) endfunc + +func Test_term_nasty_callback() + func OpenTerms() + set hidden + let g:buf0 = term_start('sh', #{hidden: 1}) + call popup_create(g:buf0, {}) + let g:buf1 = term_start('sh', #{hidden: 1, term_finish: 'close'}) + call popup_create(g:buf1, {}) + let g:buf2 = term_start(['sh', '-c'], #{curwin: 1, exit_cb: function('TermExit')}) + sleep 100m + call popup_close(win_getid()) + endfunc + func TermExit(...) + call term_sendkeys(bufnr('#'), "exit\<CR>") + call popup_close(win_getid()) + endfu + call OpenTerms() + + call term_sendkeys(g:buf0, "exit\<CR>") + sleep 50m + exe g:buf0 .. 'bwipe' + set hidden& +endfunc + |