diff src/testdir/test_vimscript.vim @ 17127:d244a9be99db v8.1.1563

patch 8.1.1563: crash when using closures commit https://github.com/vim/vim/commit/6e5000d493b4f385f901eb97f3ce0c8088373403 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jun 17 21:18:41 2019 +0200 patch 8.1.1563: crash when using closures Problem: Crash when using closures. Solution: Set reference in varlist of funccal when running the garbage collector. (Ozaki Kiichi, closes #4554, closes #4547)
author Bram Moolenaar <Bram@vim.org>
date Mon, 17 Jun 2019 21:30:08 +0200
parents b55b4a21f006
children a5c3d374e1d3
line wrap: on
line diff
--- a/src/testdir/test_vimscript.vim
+++ b/src/testdir/test_vimscript.vim
@@ -1665,6 +1665,17 @@ func Test_refcount()
     delfunc DictFunc
 endfunc
 
+func! Test_funccall_garbage_collect()
+    func Func(x, ...)
+        call add(a:x, a:000)
+    endfunc
+    call Func([], [])
+    " Must not crash cause by invalid freeing
+    call test_garbagecollect_now()
+    call assert_true(v:true)
+    delfunc Func
+endfunc
+
 "-------------------------------------------------------------------------------
 " Modelines								    {{{1
 " vim: ts=8 sw=4 tw=80 fdm=marker