comparison src/testdir/test_timers.vim @ 17159:3fd0765f454f v8.1.1579

patch 8.1.1579: dict and list could be GC'ed while displaying error commit https://github.com/vim/vim/commit/adc6714aac20f5462a0ecec50ab4806b2f3ab0db Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 22 01:40:42 2019 +0200 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 #4571)
author Bram Moolenaar <Bram@vim.org>
date Sat, 22 Jun 2019 01:45:05 +0200
parents 8e9e9124c7a2
children 7927cf327396
comparison
equal deleted inserted replaced
17158:7aee4ff9e8a5 17159:3fd0765f454f
307 call StopVimInTerminal(buf) 307 call StopVimInTerminal(buf)
308 call delete('Xtrcscript') 308 call delete('Xtrcscript')
309 call delete('Xtrctext') 309 call delete('Xtrctext')
310 endfunc 310 endfunc
311 311
312 " Test that the garbage collector isn't triggered if a timer callback invokes
313 " vgetc().
314 func Test_nocatch_garbage_collect()
315 " 'uptimetime. must be bigger than the timer timeout
316 set ut=200
317 call test_garbagecollect_soon()
318 call test_override('no_wait_return', 0)
319 func CauseAnError(id)
320 " This will show an error and wait for Enter.
321 let a = {'foo', 'bar'}
322 endfunc
323 func FeedChar(id)
324 call feedkeys('x', 't')
325 endfunc
326 call timer_start(300, 'FeedChar')
327 call timer_start(100, 'CauseAnError')
328 let x = getchar()
329
330 set ut&
331 call test_override('no_wait_return', 1)
332 delfunc CauseAnError
333 delfunc FeedChar
334 endfunc
335
312 " vim: shiftwidth=2 sts=2 expandtab 336 " vim: shiftwidth=2 sts=2 expandtab