0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.3809: Vim9: crash when garbage collecting a nested partial

Problem:    Vim9: crash when garbage collecting a nested partial. (Virginia
            Senioria)
Solution:   Set references in all the funcstacks. (closes #9348)
This commit is contained in:
Bram Moolenaar
2021-12-14 18:14:37 +00:00
parent 919c12c19a
commit 7509ad8b0f
6 changed files with 100 additions and 12 deletions

View File

@@ -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