mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
vim-patch:7.4.1860
Problem: Using a partial for timer_start() may cause a crash.
Solution: Set the copyID in timer objects. (Ozaki Kiichi)
e3188e2615
This commit is contained in:

committed by
James McCoy

parent
c52856af2c
commit
537cee4883
@@ -8,6 +8,10 @@ func MyHandler(timer)
|
|||||||
let s:val += 1
|
let s:val += 1
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func MyHandlerWithLists(lists, timer)
|
||||||
|
let x = string(a:lists)
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_oneshot()
|
func Test_oneshot()
|
||||||
let s:val = 0
|
let s:val = 0
|
||||||
let timer = timer_start(50, 'MyHandler')
|
let timer = timer_start(50, 'MyHandler')
|
||||||
@@ -31,15 +35,20 @@ func Test_repeat_many()
|
|||||||
call assert_true(s:val < 5)
|
call assert_true(s:val < 5)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" func Test_with_partial_callback()
|
func Test_with_partial_callback()
|
||||||
" let s:val = 0
|
let s:val = 0
|
||||||
" let s:meow = {}
|
let s:meow = {}
|
||||||
" function s:meow.bite(...)
|
function s:meow.bite(...)
|
||||||
" let s:val += 1
|
let s:val += 1
|
||||||
" endfunction
|
endfunction
|
||||||
|
call timer_start(50, s:meow.bite)
|
||||||
|
sleep 200m
|
||||||
|
call assert_equal(1, s:val)
|
||||||
|
endfunc
|
||||||
|
|
||||||
" call timer_start(50, s:meow.bite)
|
func Test_retain_partial()
|
||||||
" sleep 200m
|
call timer_start(100, function('MyHandlerWithLists', [['a']]))
|
||||||
" call assert_equal(1, s:val)
|
call garbagecollect()
|
||||||
" endfunc
|
sleep 200m
|
||||||
|
endfunc
|
||||||
" vim: ts=2 sw=0 et
|
" vim: ts=2 sw=0 et
|
||||||
|
@@ -580,7 +580,7 @@ static int included_patches[] = {
|
|||||||
// 1863 NA
|
// 1863 NA
|
||||||
// 1862,
|
// 1862,
|
||||||
// 1861,
|
// 1861,
|
||||||
// 1860 NA
|
1860,
|
||||||
// 1859 NA
|
// 1859 NA
|
||||||
// 1858 NA
|
// 1858 NA
|
||||||
// 1857 NA
|
// 1857 NA
|
||||||
|
Reference in New Issue
Block a user