changeset 25765:d62bf68986df v8.2.3418

patch 8.2.3418: garbage collection while evaluating may cause trouble Commit: https://github.com/vim/vim/commit/070ac3433b0ebefd6dc6cd49707fcfa1421b9e67 Author: Christian Brabandt <cb@256bit.org> Date: Thu Sep 9 12:12:03 2021 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Thu, 09 Sep 2021 12:15:06 +0200
parents ca88b83dc89a
children c0b0335f8aa9
files src/eval.c src/version.c
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -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;
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3418,
+/**/
     3417,
 /**/
     3416,