summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-14 18:14:37 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-14 18:14:37 +0000
commit7509ad8b0fad56f88288977decbeca3640406c82 (patch)
treebd5e3baad50de512990bb3ba1257452d4bf5f244 /src/eval.c
parent919c12c19a9785b856bc32dfe6cd8e9277178b62 (diff)
patch 8.2.3809: Vim9: crash when garbage collecting a nested partialv8.2.3809
Problem: Vim9: crash when garbage collecting a nested partial. (Virginia Senioria) Solution: Set references in all the funcstacks. (closes #9348)
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/eval.c b/src/eval.c
index abfde87f35..0a85b909d0 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -4510,6 +4510,9 @@ garbage_collect(int testing)
// function call arguments, if v:testing is set.
abort = abort || set_ref_in_func_args(copyID);
+ // funcstacks keep variables for closures
+ abort = abort || set_ref_in_funcstacks(copyID);
+
// v: vars
abort = abort || garbage_collect_vimvars(copyID);
@@ -4869,15 +4872,7 @@ set_ref_in_item(
for (i = 0; i < pt->pt_argc; ++i)
abort = abort || set_ref_in_item(&pt->pt_argv[i], copyID,
ht_stack, list_stack);
- if (pt->pt_funcstack != NULL)
- {
- typval_T *stack = pt->pt_funcstack->fs_ga.ga_data;
-
- for (i = 0; i < pt->pt_funcstack->fs_ga.ga_len; ++i)
- abort = abort || set_ref_in_item(stack + i, copyID,
- ht_stack, list_stack);
- }
-
+ // pt_funcstack is handled in set_ref_in_funcstacks()
}
}
#ifdef FEAT_JOB_CHANNEL