Patch 8.2.2190
Problem:    Vim9: crash when compiled with EXITFREE.
Solution:   Check that df_ufunc is not NULL.
Files:      src/vim9compile.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.2189/src/vim9compile.c   2020-12-22 17:35:50.043978116 +0100
--- src/vim9compile.c   2020-12-22 18:31:13.887770665 +0100
***************
*** 8081,8089 ****
            {
                dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
                                               + isn->isn_arg.funcref.fr_func;
  
!               if (func_name_refcount(dfunc->df_ufunc->uf_name))
!                   func_ptr_unref(dfunc->df_ufunc);
            }
            break;
  
--- 8081,8090 ----
            {
                dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
                                               + isn->isn_arg.funcref.fr_func;
+               ufunc_T *ufunc = dfunc->df_ufunc;
  
!               if (ufunc != NULL && func_name_refcount(ufunc->uf_name))
!                   func_ptr_unref(ufunc);
            }
            break;
  
*** ../vim-8.2.2189/src/testdir/test_vim9_func.vim      2020-12-22 
17:35:50.043978116 +0100
--- src/testdir/test_vim9_func.vim      2020-12-22 18:31:58.415610607 +0100
***************
*** 2011,2015 ****
--- 2011,2037 ----
    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
*** ../vim-8.2.2189/src/version.c       2020-12-22 17:59:28.067057967 +0100
--- src/version.c       2020-12-22 18:30:28.327934569 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2190,
  /**/

-- 
A)bort, R)etry, B)ang it with a large hammer

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202012221733.0BMHX4Gs2622929%40masaka.moolenaar.net.

Raspunde prin e-mail lui