aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-04-06 08:56:53 -0400
committerJames McCoy <jamessan@jamessan.com>2017-04-06 08:57:22 -0400
commit9edbeec07716cff5607202dbd20b81917416030f (patch)
tree07cb1235ebedfae5101436676ee2c41625b682ea
parent0f99645b8faf3e5970e46c185c0cbbd7a9cfe318 (diff)
downloadrneovim-9edbeec07716cff5607202dbd20b81917416030f.tar.gz
rneovim-9edbeec07716cff5607202dbd20b81917416030f.tar.bz2
rneovim-9edbeec07716cff5607202dbd20b81917416030f.zip
vim-patch:7.4.2332
Problem: Crash when stop_timer() is called in a callback of a callback. Vim hangs when the timer callback uses too much time. Solution: Set tr_id to -1 when a timer is to be deleted. Don't keep calling callbacks forever. (Ozaki Kiichi) https://github.com/vim/vim/commit/75537a93e985ef32e6c267b06ce93629855dd983
-rw-r--r--src/nvim/testdir/test_timers.vim30
-rw-r--r--src/nvim/version.c2
2 files changed, 31 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim
index 6a8b09c898..2a768585ce 100644
--- a/src/nvim/testdir/test_timers.vim
+++ b/src/nvim/testdir/test_timers.vim
@@ -140,4 +140,34 @@ func Test_delete_myself()
call assert_equal([], timer_info(t))
endfunc
+func StopTimer1(timer)
+ let g:timer2 = timer_start(10, 'StopTimer2')
+ " avoid maxfuncdepth error
+ call timer_pause(g:timer1, 1)
+ sleep 40m
+endfunc
+
+func StopTimer2(timer)
+ call timer_stop(g:timer1)
+endfunc
+
+func Test_stop_in_callback()
+ let g:timer1 = timer_start(10, 'StopTimer1')
+ sleep 40m
+endfunc
+
+func StopTimerAll(timer)
+ call timer_stopall()
+endfunc
+
+func Test_stop_all_in_callback()
+ let g:timer1 = timer_start(10, 'StopTimerAll')
+ let info = timer_info()
+ call assert_equal(1, len(info))
+ sleep 40m
+ let info = timer_info()
+ call assert_equal(0, len(info))
+endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/version.c b/src/nvim/version.c
index beb23090ec..d16eab7201 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -109,7 +109,7 @@ static const int included_patches[] = {
2335,
2334,
2333,
- // 2332 NA
+ 2332,
2331,
2330,
2329,