Mercurial > vim
diff src/testdir/test_terminal.vim @ 19629:804322d6c6ba v8.2.0371
patch 8.2.0371: crash with combination of terminal popup and autocmd
Commit: https://github.com/vim/vim/commit/cee52204ca030ce7814844e4dab8b4ed897ba3cc
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 11 14:19:58 2020 +0100
patch 8.2.0371: crash with combination of terminal popup and autocmd
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 11 Mar 2020 14:30:04 +0100 |
parents | 47db1e17d0a4 |
children | dd3e5533a7d2 |
line wrap: on
line diff
--- 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 +