aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-01-05 10:40:02 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-01-05 10:40:53 -0500
commit1aacab49ea0e5cff94bd89595737b6af677f4490 (patch)
tree3d917be003cb49e95a3ea021145701f44cfb39b9 /src/nvim/testdir
parent3a3fb0860248b42e05de6591d4b7727453efdef2 (diff)
downloadrneovim-1aacab49ea0e5cff94bd89595737b6af677f4490.tar.gz
rneovim-1aacab49ea0e5cff94bd89595737b6af677f4490.tar.bz2
rneovim-1aacab49ea0e5cff94bd89595737b6af677f4490.zip
vim-patch:8.1.1579: dict and list could be GC'ed while displaying error
Problem: Dict and list could be GC'ed while displaying error in a timer. (Yasuhiro Matsumoto) Solution: Block garbage collection when executing a timer. Add test_garbagecollect_soon(). Add "no_wait_return" to test_override(). (closes vim/vim#4571) https://github.com/vim/vim/commit/adc6714aac20f5462a0ecec50ab4806b2f3ab0db
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_timers.vim26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim
index c4d74222a4..3043103270 100644
--- a/src/nvim/testdir/test_timers.vim
+++ b/src/nvim/testdir/test_timers.vim
@@ -313,4 +313,30 @@ func Test_restore_count()
call delete('Xtrctext')
endfunc
+" Test that the garbage collector isn't triggered if a timer callback invokes
+" vgetc().
+func Test_nocatch_garbage_collect()
+ " skipped: Nvim does not support test_garbagecollect_soon(), test_override()
+ return
+ " 'uptimetime. must be bigger than the timer timeout
+ set ut=200
+ call test_garbagecollect_soon()
+ call test_override('no_wait_return', 0)
+ func CauseAnError(id)
+ " This will show an error and wait for Enter.
+ let a = {'foo', 'bar'}
+ endfunc
+ func FeedChar(id)
+ call feedkeys('x', 't')
+ endfunc
+ call timer_start(300, 'FeedChar')
+ call timer_start(100, 'CauseAnError')
+ let x = getchar()
+
+ set ut&
+ call test_override('no_wait_return', 1)
+ delfunc CauseAnError
+ delfunc FeedChar
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab