To: vim_dev@googlegroups.com Subject: Patch 8.2.0826 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0826 Problem: Vim9: crash in :defcompile. Solution: Restart the loop after a call to compile_def_function() caused the hash table to resize. Files: src/userfunc.c *** ../vim-8.2.0825/src/userfunc.c 2020-05-25 23:29:24.572124376 +0200 --- src/userfunc.c 2020-05-26 11:05:31.072892705 +0200 *************** *** 3326,3332 **** void ex_defcompile(exarg_T *eap UNUSED) { ! int todo = (int)func_hashtab.ht_used; hashitem_T *hi; ufunc_T *ufunc; --- 3326,3333 ---- void ex_defcompile(exarg_T *eap UNUSED) { ! long_u ht_used = func_hashtab.ht_used; ! int todo = (int)ht_used; hashitem_T *hi; ufunc_T *ufunc; *************** *** 3338,3344 **** --- 3339,3355 ---- 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; + } + } } } } *** ../vim-8.2.0825/src/version.c 2020-05-25 23:29:24.572124376 +0200 --- src/version.c 2020-05-26 11:07:59.672488579 +0200 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 826, /**/ -- hundred-and-one symptoms of being an internet addict: 179. You wonder why your household garbage can doesn't have an "empty recycle bin" button. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///