Skip to content

Commit 7a5c46a

Browse files
committed
patch 7.4.1580
Problem: Crash when using function reference. (Luchr) Solution: Set initial refcount. (Ken Takata, closes #690)
1 parent a3dc5e9 commit 7a5c46a

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/eval.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21705,6 +21705,7 @@ handle_subscript(
2170521705
/* Turn "dict.Func" into a partial for "Func" with "dict". */
2170621706
if (pt != NULL)
2170721707
{
21708+
pt->pt_refcount = 1;
2170821709
pt->pt_dict = selfdict;
2170921710
selfdict = NULL;
2171021711
pt->pt_name = rettv->vval.v_string;

src/testdir/test_partial.vim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,17 @@ func Test_partial_implicit()
6868

6969
call assert_fails('call function(dict.MyFunc, ["bbb"], dict)', 'E924:')
7070
endfunc
71+
72+
fun InnerCall(funcref)
73+
return a:funcref
74+
endfu
75+
76+
fun OuterCall()
77+
let opt = { 'func' : function('sin') }
78+
call InnerCall(opt.func)
79+
endfu
80+
81+
func Test_function_in_dict()
82+
call OuterCall()
83+
endfunc
84+

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1580,
751753
/**/
752754
1579,
753755
/**/

0 commit comments

Comments
 (0)