diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-12-22 17:35:54 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-12-22 17:35:54 +0100 |
commit | cd45ed03bfdd7fac53d562ad402df74bd26e7754 (patch) | |
tree | 08509cca8dd5a9615671f1d0f3fc50fa0b4f5ef0 /src/proto | |
parent | 07761a3b965ec3be0c8d52aae9b6dc09c2127d27 (diff) | |
download | vim-git-cd45ed03bfdd7fac53d562ad402df74bd26e7754.tar.gz |
patch 8.2.2188: Vim9: crash when calling global function from :def functionv8.2.2188
Problem: Vim9: crash when calling global function from :def function.
Solution: Set the outer context. Define the partial for the context on the
original function. Use a refcount to keep track of which ufunc is
using a dfunc. (closes #7525)
Diffstat (limited to 'src/proto')
-rw-r--r-- | src/proto/userfunc.pro | 2 | ||||
-rw-r--r-- | src/proto/vim9compile.pro | 2 | ||||
-rw-r--r-- | src/proto/vim9execute.pro | 1 |
3 files changed, 3 insertions, 2 deletions
diff --git a/src/proto/userfunc.pro b/src/proto/userfunc.pro index c79c101c6..da4a880dc 100644 --- a/src/proto/userfunc.pro +++ b/src/proto/userfunc.pro @@ -13,7 +13,7 @@ ufunc_T *find_func_even_dead(char_u *name, int is_global, cctx_T *cctx); ufunc_T *find_func(char_u *name, int is_global, cctx_T *cctx); int func_is_global(ufunc_T *ufunc); int func_name_refcount(char_u *name); -ufunc_T *copy_func(char_u *lambda, char_u *global); +int copy_func(char_u *lambda, char_u *global, ectx_T *ectx); int funcdepth_increment(void); void funcdepth_decrement(void); int funcdepth_get(void); diff --git a/src/proto/vim9compile.pro b/src/proto/vim9compile.pro index a19088bc6..3f8ae13c3 100644 --- a/src/proto/vim9compile.pro +++ b/src/proto/vim9compile.pro @@ -18,7 +18,7 @@ int check_vim9_unlet(char_u *name); int compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx); void set_function_type(ufunc_T *ufunc); void delete_instr(isn_T *isn); -void clear_def_function(ufunc_T *ufunc); void unlink_def_function(ufunc_T *ufunc); +void link_def_function(ufunc_T *ufunc); void free_def_functions(void); /* vim: set ft=c : */ diff --git a/src/proto/vim9execute.pro b/src/proto/vim9execute.pro index 882456df8..8e948c550 100644 --- a/src/proto/vim9execute.pro +++ b/src/proto/vim9execute.pro @@ -1,6 +1,7 @@ /* vim9execute.c */ void to_string_error(vartype_T vartype); void funcstack_check_refcount(funcstack_T *funcstack); +int fill_partial_and_closure(partial_T *pt, ufunc_T *ufunc, ectx_T *ectx); int call_def_function(ufunc_T *ufunc, int argc_arg, typval_T *argv, partial_T *partial, typval_T *rettv); void ex_disassemble(exarg_T *eap); int tv2bool(typval_T *tv); |