]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1580 v7.4.1580
authorBram Moolenaar <Bram@vim.org>
Wed, 16 Mar 2016 19:41:21 +0000 (20:41 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 16 Mar 2016 19:41:21 +0000 (20:41 +0100)
Problem:    Crash when using function reference. (Luchr)
Solution:   Set initial refcount. (Ken Takata, closes #690)

src/eval.c
src/testdir/test_partial.vim
src/version.c

index 506932403a9da1a5246f6f905f310c563db3e00b..85f209221ab6b1186aaa0b9ad7cc05cf54a01057 100644 (file)
@@ -21705,6 +21705,7 @@ handle_subscript(
        /* Turn "dict.Func" into a partial for "Func" with "dict". */
        if (pt != NULL)
        {
+           pt->pt_refcount = 1;
            pt->pt_dict = selfdict;
            selfdict = NULL;
            pt->pt_name = rettv->vval.v_string;
index ddc85e0ef990f003657e52b565a9a879d726cc6f..acba887cbf5c7468b120d7b32dfba133aae7a3ad 100644 (file)
@@ -68,3 +68,17 @@ func Test_partial_implicit()
 
   call assert_fails('call function(dict.MyFunc, ["bbb"], dict)', 'E924:')
 endfunc
+
+fun InnerCall(funcref)
+  return a:funcref
+endfu
+
+fun OuterCall()
+  let opt = { 'func' : function('sin') }
+  call InnerCall(opt.func)
+endfu
+
+func Test_function_in_dict()
+  call OuterCall()
+endfunc
+
index e4c3412d77f6b982169db3d9bae72db9b71d340e..cb291581d2b291c3695ed61caa5a6771e0ff5a3c 100644 (file)
@@ -748,6 +748,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1580,
 /**/
     1579,
 /**/