patch 9.0.0949: crash when unletting a variable while listing variables
Problem: Crash when unletting a variable while listing variables.
Solution: Disallow changing a hashtable while going over the entries.
(closes #11435)
diff --git a/src/if_ruby.c b/src/if_ruby.c
index feb1d50..51cfff1 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -1799,7 +1799,7 @@
if (di == NULL || ruby_convert_to_vim_value(val, &di->di_tv) != OK
|| dict_add(d, di) != OK)
{
- d->dv_hashtab.ht_error = TRUE;
+ d->dv_hashtab.ht_flags |= HTFLAGS_ERROR;
return ST_STOP;
}
return ST_CONTINUE;
@@ -1879,7 +1879,7 @@
return FAIL;
rb_hash_foreach(val, convert_hash2dict, (VALUE)d);
- if (d->dv_hashtab.ht_error)
+ if (d->dv_hashtab.ht_flags & HTFLAGS_ERROR)
{
dict_unref(d);
return FAIL;