0
0
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:
Bram Moolenaar
2016-08-01 22:49:22 +02:00
parent 8dd3a43d75
commit bc7ce675b2
5 changed files with 98 additions and 57 deletions

View File

@@ -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