diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-16 20:41:21 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-16 20:41:21 +0100 |
commit | 7a5c46a9df7ef01a4f6a620861c35400d5ad28d9 (patch) | |
tree | ae1e23483268d9ac678fd0ae9187d5d9eac8ffb1 | |
parent | a3dc5e92dcb79bdc4f0103e6eb91de4c7a6ee9a7 (diff) | |
download | vim-git-7a5c46a9df7ef01a4f6a620861c35400d5ad28d9.tar.gz |
patch 7.4.1580v7.4.1580
Problem: Crash when using function reference. (Luchr)
Solution: Set initial refcount. (Ken Takata, closes #690)
-rw-r--r-- | src/eval.c | 1 | ||||
-rw-r--r-- | src/testdir/test_partial.vim | 14 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c index 506932403..85f209221 100644 --- a/src/eval.c +++ b/src/eval.c @@ -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; diff --git a/src/testdir/test_partial.vim b/src/testdir/test_partial.vim index ddc85e0ef..acba887cb 100644 --- a/src/testdir/test_partial.vim +++ b/src/testdir/test_partial.vim @@ -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 + diff --git a/src/version.c b/src/version.c index e4c3412d7..cb291581d 100644 --- a/src/version.c +++ b/src/version.c @@ -749,6 +749,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1580, +/**/ 1579, /**/ 1578, |