diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-11-25 16:31:51 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-11-25 16:31:51 +0000 |
commit | ef2c325f5e3c437b722bb96bf369ba2a5c541163 (patch) | |
tree | dc85f0dc98dce1937b459d8d3882473f25db03c3 /src/buffer.c | |
parent | c1cf4c91072f91b6b8dd636627a4ddf6f4b21f16 (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/buffer.c')
-rw-r--r-- | src/buffer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c index de4c40b585..f99da25e88 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -434,7 +434,7 @@ static hashtab_T buf_hashtab; buf_hashtab_add(buf_T *buf) { sprintf((char *)buf->b_key, "%x", buf->b_fnum); - if (hash_add(&buf_hashtab, buf->b_key) == FAIL) + if (hash_add(&buf_hashtab, buf->b_key, "create buffer") == FAIL) emsg(_(e_buffer_cannot_be_registered)); } @@ -444,7 +444,7 @@ buf_hashtab_remove(buf_T *buf) hashitem_T *hi = hash_find(&buf_hashtab, buf->b_key); if (!HASHITEM_EMPTY(hi)) - hash_remove(&buf_hashtab, hi); + hash_remove(&buf_hashtab, hi, "close buffer"); } /* @@ -925,7 +925,7 @@ free_buffer(buf_T *buf) free_buffer_stuff(buf, TRUE); #ifdef FEAT_EVAL // b:changedtick uses an item in buf_T, remove it now - dictitem_remove(buf->b_vars, (dictitem_T *)&buf->b_ct_di); + dictitem_remove(buf->b_vars, (dictitem_T *)&buf->b_ct_di, "free buffer"); unref_var_dict(buf->b_vars); remove_listeners(buf); #endif |