mirror of
https://github.com/vim/vim.git
synced 2025-10-05 05:34:07 -04:00
patch 7.4.2143
Problem: A funccal is garbage collected while it can still be used. Solution: Set copyID in all referenced functions. Do not list lambda functions with ":function".
This commit is contained in:
@@ -270,3 +270,17 @@ func Test_closure_refcount()
|
||||
delfunc LambdaFoo
|
||||
delfunc LambdaBar
|
||||
endfunc
|
||||
|
||||
func Test_named_function_closure()
|
||||
func! Afoo()
|
||||
let x = 14
|
||||
func! s:Abar() closure
|
||||
return x
|
||||
endfunc
|
||||
call assert_equal(14, s:Abar())
|
||||
endfunc
|
||||
call Afoo()
|
||||
call assert_equal(14, s:Abar())
|
||||
call test_garbagecollect_now()
|
||||
call assert_equal(14, s:Abar())
|
||||
endfunc
|
||||
|
Reference in New Issue
Block a user