Mercurial > vim
changeset 20544:e8132bec4b0f v8.2.0826
patch 8.2.0826: Vim9: crash in :defcompile
Commit: https://github.com/vim/vim/commit/ebc3de634f4c2893f34e41b4f8da1d59212e59ea
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 26 11:08:28 2020 +0200
patch 8.2.0826: Vim9: crash in :defcompile
Problem: Vim9: crash in :defcompile.
Solution: Restart the loop after a call to compile_def_function() caused the
hash table to resize.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 26 May 2020 11:15:04 +0200 |
parents | 697fcaa406af |
children | 69d7432bec0a |
files | src/userfunc.c src/version.c |
diffstat | 2 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -3326,7 +3326,8 @@ ex_function(exarg_T *eap) void ex_defcompile(exarg_T *eap UNUSED) { - int todo = (int)func_hashtab.ht_used; + long_u ht_used = func_hashtab.ht_used; + int todo = (int)ht_used; hashitem_T *hi; ufunc_T *ufunc; @@ -3338,7 +3339,17 @@ ex_defcompile(exarg_T *eap UNUSED) ufunc = HI2UF(hi); if (ufunc->uf_script_ctx.sc_sid == current_sctx.sc_sid && ufunc->uf_dfunc_idx == UF_TO_BE_COMPILED) + { compile_def_function(ufunc, FALSE, NULL); + + if (func_hashtab.ht_used != ht_used) + { + // another function has been defined, need to start over + hi = func_hashtab.ht_array; + ht_used = func_hashtab.ht_used; + todo = (int)ht_used; + } + } } } }