0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.3418: garbage collection while evaluating may cause trouble

Problem:    Garbage collection while evaluating may cause trouble.
Solution:   Disable garbage collection while evaluating an expression.
            (Christian Brabandt, issue #8848)
This commit is contained in:
Christian Brabandt
2021-09-09 12:12:03 +02:00
committed by Bram Moolenaar
parent 072f1c6888
commit 070ac3433b
2 changed files with 5 additions and 0 deletions

View File

@@ -561,16 +561,19 @@ eval_to_string_safe(
char_u *retval;
funccal_entry_T funccal_entry;
int save_sc_version = current_sctx.sc_version;
int save_garbage = may_garbage_collect;
current_sctx.sc_version = 1;
save_funccal(&funccal_entry);
if (use_sandbox)
++sandbox;
++textwinlock;
may_garbage_collect = FALSE;
retval = eval_to_string(arg, FALSE);
if (use_sandbox)
--sandbox;
--textwinlock;
may_garbage_collect = save_garbage;
restore_funccal();
current_sctx.sc_version = save_sc_version;
return retval;