comparison src/evalvars.c @ 22602:2c77ec32deeb v8.2.1849

patch 8.2.1849: Vim9: garbage collection frees block-local variables Commit: https://github.com/vim/vim/commit/ed234f24f3a6d697ba9b786d0bc74d4682bfdf47 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 15 20:42:20 2020 +0200 patch 8.2.1849: Vim9: garbage collection frees block-local variables Problem: Vim9: garbage collection frees block-local variables. Solution: Mark all script variables as used.
author Bram Moolenaar <Bram@vim.org>
date Thu, 15 Oct 2020 20:45:05 +0200
parents 209c7aa56325
children 87987c783087
comparison
equal deleted inserted replaced
22601:e4ba57ce600b 22602:2c77ec32deeb
301 } 301 }
302 302
303 int 303 int
304 garbage_collect_scriptvars(int copyID) 304 garbage_collect_scriptvars(int copyID)
305 { 305 {
306 int i; 306 int i;
307 int abort = FALSE; 307 int idx;
308 int abort = FALSE;
309 scriptitem_T *si;
308 310
309 for (i = 1; i <= script_items.ga_len; ++i) 311 for (i = 1; i <= script_items.ga_len; ++i)
312 {
310 abort = abort || set_ref_in_ht(&SCRIPT_VARS(i), copyID, NULL); 313 abort = abort || set_ref_in_ht(&SCRIPT_VARS(i), copyID, NULL);
314
315 si = SCRIPT_ITEM(i);
316 for (idx = 0; idx < si->sn_var_vals.ga_len; ++idx)
317 {
318 svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx;
319
320 abort = abort || set_ref_in_item(sv->sv_tv, copyID, NULL, NULL);
321 }
322 }
311 323
312 return abort; 324 return abort;
313 } 325 }
314 326
315 /* 327 /*