diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-12-02 20:51:22 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-12-02 20:51:22 +0100 |
commit | af0df47a7671a39f2cde950587ba48800188bfb9 (patch) | |
tree | d926cdf6f0d78ba501006970622deae3928d0fe5 | |
parent | e0de171ecd2ff7acd56deda2cf81f0d13a69c803 (diff) | |
download | vim-git-af0df47a7671a39f2cde950587ba48800188bfb9.tar.gz |
patch 8.2.2083: Vim9: crash when using ":silent!" and getting member failsv8.2.2083
Problem: Vim9: crash when using ":silent!" and getting member fails.
Solution: Jump to on_fatal_error. (closes #7412)
-rw-r--r-- | src/testdir/test_vim9_func.vim | 14 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9execute.c | 10 |
3 files changed, 22 insertions, 4 deletions
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 554d8902a..86b57f3c1 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1768,5 +1768,19 @@ def Test_reset_did_emsg() 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 diff --git a/src/version.c b/src/version.c index 0c049905f..0dfe4f064 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 */ /**/ + 2083, +/**/ 2082, /**/ 2081, diff --git a/src/vim9execute.c b/src/vim9execute.c index ab2cf385f..a9fd94e9c 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -2669,12 +2669,12 @@ call_def_function( { SOURCING_LNUM = iptr->isn_lnum; semsg(_(e_dictkey), key); - goto on_error; + goto on_fatal_error; } clear_tv(tv); --ectx.ec_stack.ga_len; - // Clear the dict after getting the item, to avoid that it - // make the item invalid. + // 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,10 +2997,12 @@ func_return: 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; |