Mercurial > vim
diff src/eval.c @ 26560:454a1c9ef797 v8.2.3809
patch 8.2.3809: Vim9: crash when garbage collecting a nested partial
Commit: https://github.com/vim/vim/commit/7509ad8b0fad56f88288977decbeca3640406c82
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 14 18:14:37 2021 +0000
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 14 Dec 2021 19:15:04 +0100 |
parents | dff04b7fa6b2 |
children | 479022b3e7bd |
line wrap: on
line diff
--- 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