aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Ennen <mike.ennen@gmail.com>2016-10-26 12:26:06 -0700
committerJames McCoy <jamessan@jamessan.com>2016-12-12 10:17:35 -0500
commit2c1b4c7f3c13b61dab70d6ad3507b90c7a60e4aa (patch)
tree224b21392bff4cd256aff898176bce22cd9898b0
parent529482d6844474f6eab9feed5162008b652fd931 (diff)
downloadrneovim-2c1b4c7f3c13b61dab70d6ad3507b90c7a60e4aa.tar.gz
rneovim-2c1b4c7f3c13b61dab70d6ad3507b90c7a60e4aa.tar.bz2
rneovim-2c1b4c7f3c13b61dab70d6ad3507b90c7a60e4aa.zip
vim-patch:7.4.1580
Problem: Crash when using function reference. (Luchr) Solution: Set initial refcount. (Ken Takata) https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
-rw-r--r--src/nvim/eval.c1
-rw-r--r--src/nvim/testdir/test_partial.vim14
-rw-r--r--src/nvim/version.c2
3 files changed, 16 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 57c1c8e210..fc0b2ee23d 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -18340,6 +18340,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/nvim/testdir/test_partial.vim b/src/nvim/testdir/test_partial.vim
index caae1a8cb1..f6f6b87a29 100644
--- a/src/nvim/testdir/test_partial.vim
+++ b/src/nvim/testdir/test_partial.vim
@@ -67,3 +67,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/nvim/version.c b/src/nvim/version.c
index 4de8296ccd..9964f92132 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -862,7 +862,7 @@ static int included_patches[] = {
// 1583 NA
// 1582,
// 1581,
- // 1580,
+ 1580,
// 1579 NA
1578,
1577,