diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-06-22 01:40:42 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-06-22 01:40:42 +0200 |
commit | adc6714aac20f5462a0ecec50ab4806b2f3ab0db (patch) | |
tree | 54650818f8664ba76e6cad1632d463ed6b9aec74 /src/testdir/test_timers.vim | |
parent | dfc145572813c5d3848feb4029ff8bfb127ab66a (diff) | |
download | vim-git-adc6714aac20f5462a0ecec50ab4806b2f3ab0db.tar.gz |
patch 8.1.1579: dict and list could be GC'ed while displaying errorv8.1.1579
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 #4571)
Diffstat (limited to 'src/testdir/test_timers.vim')
-rw-r--r-- | src/testdir/test_timers.vim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim index 03391d8f5..e67da134b 100644 --- a/src/testdir/test_timers.vim +++ b/src/testdir/test_timers.vim @@ -309,4 +309,28 @@ 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() + " '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 |