To: vim_dev@googlegroups.com Subject: Patch 8.2.2083 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2083 Problem: Vim9: crash when using ":silent!" and getting member fails. Solution: Jump to on_fatal_error. (closes #7412) Files: src/vim9execute.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.2082/src/vim9execute.c 2020-11-25 19:15:15.443211576 +0100 --- src/vim9execute.c 2020-12-02 20:49:12.805873404 +0100 *************** *** 2669,2680 **** { SOURCING_LNUM = iptr->isn_lnum; semsg(_(e_dictkey), key); ! goto on_error; } clear_tv(tv); --ectx.ec_stack.ga_len; ! // Clear the dict after getting the item, to avoid that it ! // make the item invalid. tv = STACK_TV_BOT(-1); temp_tv = *tv; copy_tv(&di->di_tv, tv); --- 2669,2680 ---- { SOURCING_LNUM = iptr->isn_lnum; semsg(_(e_dictkey), key); ! goto on_fatal_error; } clear_tv(tv); --ectx.ec_stack.ga_len; ! // Clear the dict only after getting the item, to avoid ! // that it makes the item invalid. tv = STACK_TV_BOT(-1); temp_tv = *tv; copy_tv(&di->di_tv, tv); *************** *** 2997,3006 **** continue; on_error: // If "emsg_silent" is set then ignore the error. if (did_emsg_cumul + did_emsg == did_emsg_before && emsg_silent) continue; ! // If we are not inside a try-catch started here, abort execution. if (trylevel <= trylevel_at_start) goto failed; --- 2997,3008 ---- continue; on_error: + // Jump here for an error that does not require aborting execution. // If "emsg_silent" is set then ignore the error. if (did_emsg_cumul + did_emsg == did_emsg_before && emsg_silent) continue; ! on_fatal_error: ! // Jump here for an error that messes up the stack. // If we are not inside a try-catch started here, abort execution. if (trylevel <= trylevel_at_start) goto failed; *** ../vim-8.2.2082/src/testdir/test_vim9_func.vim 2020-12-02 17:36:49.173409740 +0100 --- src/testdir/test_vim9_func.vim 2020-12-02 20:48:50.946103360 +0100 *************** *** 1768,1772 **** --- 1768,1786 ---- CheckScriptFailure(lines, 'E492:', 8) enddef + def Test_abort_even_with_silent() + var lines =<< trim END + vim9script + g:result = 'none' + def Func() + eval {-> ''}() .. '' .. {}['X'] + g:result = 'yes' + enddef + sil! Func() + assert_equal('none', g:result) + END + CheckScriptSuccess(lines) + enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker *** ../vim-8.2.2082/src/version.c 2020-12-02 17:36:49.177409727 +0100 --- src/version.c 2020-12-02 20:42:53.691671384 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2083, /**/ -- When I look deep into your eyes, I see JPEG artifacts. I can tell by the pixels that we're wrong for each other. (xkcd) /// 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 ///