]> granicus.if.org Git - vim/commitdiff
patch 8.2.3418: garbage collection while evaluating may cause trouble v8.2.3418
authorChristian Brabandt <cb@256bit.org>
Thu, 9 Sep 2021 10:12:03 +0000 (12:12 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 9 Sep 2021 10:12:03 +0000 (12:12 +0200)
Problem:    Garbage collection while evaluating may cause trouble.
Solution:   Disable garbage collection while evaluating an expression.
            (Christian Brabandt, issue #8848)

src/eval.c
src/version.c

index 6b3d78aa6e4374300b24a965d56ad2ec201910d4..aceba5e2d7d4158e4f32d4f8cd9f8fb21186d7cd 100644 (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;
index 41b79a713b6e64cf7cd3f4f5e202df0259eb6639..b6216e98b9b9009a47117efbbe34124aef8b42bd 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3418,
 /**/
     3417,
 /**/