summaryrefslogtreecommitdiffstats
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-02-07 19:56:43 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-07 19:56:43 +0000
commit7aca5ca6763e50d2c23953b20e30fca7457c9abf (patch)
treea0a1e5077975c095e06f37b668baff7f68a92230 /src/evalfunc.c
parent92368aad613bca700877ccb1725e1cb5a80dd34a (diff)
patch 8.2.4322: Vim9: crash when using funcref with closurev8.2.4322
Problem: Vim9: crash when using funcref with closure. Solution: Keep a reference to the funcref that has the outer context. (closes #9716)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index eb12e75d07..b031369efd 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -4456,7 +4456,10 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
}
if (arg_pt != NULL)
- pt->pt_outer = arg_pt->pt_outer;
+ {
+ pt->pt_outer_partial = arg_pt;
+ ++arg_pt->pt_refcount;
+ }
}
rettv->v_type = VAR_PARTIAL;
rettv->vval.v_partial = pt;