diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-09-01 21:26:20 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-09-01 21:26:20 +0200 |
commit | 417ccd7138d4d230d328de8b0d3892dd82ff1bee (patch) | |
tree | 9dbbb0b04dd9a3eba03b1d949348d1616b878aef /src/testdir/test_timers.vim | |
parent | 779f2fc3a7468e273897d2fd0672315812a2e3da (diff) | |
download | vim-git-417ccd7138d4d230d328de8b0d3892dd82ff1bee.tar.gz |
patch 7.4.2304v7.4.2304
Problem: In a timer callback the timer itself can't be found or stopped.
(Thinca)
Solution: Do not remove the timer from the list, remember whether it was
freed.
Diffstat (limited to 'src/testdir/test_timers.vim')
-rw-r--r-- | src/testdir/test_timers.vim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim index 152f72502..e6e54a4cb 100644 --- a/src/testdir/test_timers.vim +++ b/src/testdir/test_timers.vim @@ -128,4 +128,19 @@ func Test_paused() endif endfunc +func StopMyself(timer) + let g:called += 1 + if g:called == 2 + call timer_stop(a:timer) + endif +endfunc + +func Test_delete_myself() + let g:called = 0 + let t = timer_start(10, 'StopMyself', {'repeat': -1}) + call WaitFor('g:called == 2') + call assert_equal(2, g:called) + call assert_equal([], timer_info(t)) +endfunc + " vim: shiftwidth=2 sts=2 expandtab |