]> granicus.if.org Git - vim/commitdiff
patch 7.4.2139 v7.4.2139
authorBram Moolenaar <Bram@vim.org>
Mon, 1 Aug 2016 14:29:47 +0000 (16:29 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 1 Aug 2016 14:29:47 +0000 (16:29 +0200)
Problem:    :delfunction causes illegal memory access.
Solution:   Correct logic when deciding to free a function.

src/testdir/test_lambda.vim
src/userfunc.c
src/version.c

index 721c47de11770837dcddbd15d5cfdb2263918bb0..1df1f1c3e3d3f6f13dfdb61d0a547c831b2b0921 100644 (file)
@@ -267,7 +267,6 @@ func Test_closure_refcount()
   call assert_equal(2, g:Count())
   call assert_equal(3, g:Count2())
 
-  " This causes memory access errors.
-  " delfunc LambdaFoo
-  " delfunc LambdaBar
+  delfunc LambdaFoo
+  delfunc LambdaBar
 endfunc
index a9dc4e843dc7c313c02423d42081fa8bc7183c2b..b7420466794f799bf209e3190acda0a656aeb6d1 100644 (file)
@@ -2711,7 +2711,7 @@ ex_delfunction(exarg_T *eap)
             * Numbered functions and lambdas snould be kept if the refcount is
             * one or more. */
            if (fp->uf_refcount > (isdigit(fp->uf_name[0])
-                                            || fp->uf_name[0] == '<') ? 0 : 1)
+                                            || fp->uf_name[0] == '<' ? 0 : 1))
            {
                /* Function is still referenced somewhere.  Don't free it but
                 * do remove it from the hashtable. */
index f1eb1fff319dc948c67cf08a7528ba4d8456454d..6f505db1164b67483c4e58c168d0b6f9862c2643 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2139,
 /**/
     2138,
 /**/