summaryrefslogtreecommitdiffstats
path: root/src/if_lua.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-11-25 16:31:51 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-25 16:31:51 +0000
commitef2c325f5e3c437b722bb96bf369ba2a5c541163 (patch)
treedc85f0dc98dce1937b459d8d3882473f25db03c3 /src/if_lua.c
parentc1cf4c91072f91b6b8dd636627a4ddf6f4b21f16 (diff)
patch 9.0.0949: crash when unletting a variable while listing variablesv9.0.0949
Problem: Crash when unletting a variable while listing variables. Solution: Disallow changing a hashtable while going over the entries. (closes #11435)
Diffstat (limited to 'src/if_lua.c')
-rw-r--r--src/if_lua.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/if_lua.c b/src/if_lua.c
index 4900534b4c..78bc190950 100644
--- a/src/if_lua.c
+++ b/src/if_lua.c
@@ -1150,7 +1150,7 @@ luaV_dict_newindex(lua_State *L)
if (lua_isnil(L, 3)) // remove?
{
hashitem_T *hi = hash_find(&d->dv_hashtab, di->di_key);
- hash_remove(&d->dv_hashtab, hi);
+ hash_remove(&d->dv_hashtab, hi, "Lua new index");
dictitem_free(di);
}
else
@@ -1838,9 +1838,8 @@ luaV_setvar(lua_State *L)
if (di == NULL)
// Doesn't exist, nothing to do
return 0;
- else
- // Delete the entry
- dictitem_remove(dict, di);
+ // Delete the entry
+ dictitem_remove(dict, di, "Lua delete variable");
}
else
{