]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.1207: Vim9: crash in expr test when run in the GUI v8.2.1207
authorBram Moolenaar <Bram@vim.org>
Tue, 14 Jul 2020 13:01:05 +0000 (15:01 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 14 Jul 2020 13:01:05 +0000 (15:01 +0200)
Problem:    Vim9: crash in expr test when run in the GUI.
Solution:   Break out of loop over hashtab also when function got removed and
            added.

src/testdir/test_vim9_expr.vim
src/userfunc.c
src/version.c

index 020a752e33a1fd7cad58b331035269e4585e3ff1..dc9514480068945fbb7f6a22a8daca83547588fa 100644 (file)
@@ -1563,10 +1563,8 @@ def Test_expr7_method_call()
 enddef
 
 func Test_expr7_trailing_fails()
-  " Temporarily commented out - somehow crash occurs with too many
-  " CheckDefFailure calls in the GUI only.
-  " call CheckDefFailure(['let l = [2]', 'l->{l -> add(l, 8)}'], 'E107')
-  " call CheckDefFailure(['let l = [2]', 'l->{l -> add(l, 8)} ()'], 'E274')
+  call CheckDefFailure(['let l = [2]', 'l->{l -> add(l, 8)}'], 'E107')
+  call CheckDefFailure(['let l = [2]', 'l->{l -> add(l, 8)} ()'], 'E274')
 endfunc
 
 func Test_expr_fails()
index 467a04601af3e46b5307aebeab9bc2c1d35a13d1..6e49c035cff40327c9a5226d5c1e5ee766338f41 100644 (file)
@@ -3444,8 +3444,8 @@ ex_function(exarg_T *eap)
     void
 ex_defcompile(exarg_T *eap UNUSED)
 {
-    long_u     ht_used = func_hashtab.ht_used;
-    int                todo = (int)ht_used;
+    long       todo = (long)func_hashtab.ht_used;
+    int                changed = func_hashtab.ht_changed;
     hashitem_T *hi;
     ufunc_T    *ufunc;
 
@@ -3460,12 +3460,12 @@ ex_defcompile(exarg_T *eap UNUSED)
            {
                compile_def_function(ufunc, FALSE, NULL);
 
-               if (func_hashtab.ht_used != ht_used)
+               if (func_hashtab.ht_changed != changed)
                {
-                   // another function has been defined, need to start over
+                   // a function has been added or removed, need to start over
+                   todo = (long)func_hashtab.ht_used;
+                   changed = func_hashtab.ht_changed;
                    hi = func_hashtab.ht_array;
-                   ht_used = func_hashtab.ht_used;
-                   todo = (int)ht_used;
                    --hi;
                }
            }
index a2775b399c53fd12cc670f9f5045ce4564a43d12..490e5a3dc5b8c6d64975ab8ef71d82cdc52621e6 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1207,
 /**/
     1206,
 /**/