diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-12-22 18:33:27 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-12-22 18:33:27 +0100 |
commit | 077a42318c20ec9e71250edd8c4346edef72281b (patch) | |
tree | 0090b6ab13daeca2e7d90c2f880f5af34926749b | |
parent | 032a2d050b82b146d70d6ff714838ee62c07d8ad (diff) | |
download | vim-git-077a42318c20ec9e71250edd8c4346edef72281b.tar.gz |
patch 8.2.2190: Vim9: crash when compiled with EXITFREEv8.2.2190
Problem: Vim9: crash when compiled with EXITFREE.
Solution: Check that df_ufunc is not NULL.
-rw-r--r-- | src/testdir/test_vim9_func.vim | 22 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9compile.c | 5 |
3 files changed, 27 insertions, 2 deletions
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 015fe3d55..3b57e312b 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -2011,5 +2011,27 @@ def Test_opfunc() nunmap <F3> enddef +" this was crashing on exit +def Test_nested_lambda_in_closure() + var lines =<< trim END + vim9script + def Outer() + def g:Inner() + echo map([1, 2, 3], {_, v -> v + 1}) + enddef + g:Inner() + enddef + defcompile + writefile(['Done'], 'XnestedDone') + quit + END + if !RunVim([], lines, '--clean') + return + endif + assert_equal(['Done'], readfile('XnestedDone')) + delete('XnestedDone') +enddef + + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker diff --git a/src/version.c b/src/version.c index 65dfcdfae..427c8f8a7 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2190, +/**/ 2189, /**/ 2188, diff --git a/src/vim9compile.c b/src/vim9compile.c index 8e07968ce..7ee15fe27 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -8081,9 +8081,10 @@ delete_instr(isn_T *isn) { dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + isn->isn_arg.funcref.fr_func; + ufunc_T *ufunc = dfunc->df_ufunc; - if (func_name_refcount(dfunc->df_ufunc->uf_name)) - func_ptr_unref(dfunc->df_ufunc); + if (ufunc != NULL && func_name_refcount(ufunc->uf_name)) + func_ptr_unref(ufunc); } break; |