mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.2122: Vim9: crash when sourcing vim9script early
Problem: Vim9: crash when sourcing vim9script early. Solution: Use set_option_value() instead of setting p_cpo directly. (closes #7441)
This commit is contained in:
@@ -1491,8 +1491,7 @@ almosttheend:
|
||||
si = SCRIPT_ITEM(current_sctx.sc_sid);
|
||||
if (si->sn_save_cpo != NULL)
|
||||
{
|
||||
free_string_option(p_cpo);
|
||||
p_cpo = si->sn_save_cpo;
|
||||
set_option_value((char_u *)"cpo", 0L, si->sn_save_cpo, 0);
|
||||
si->sn_save_cpo = NULL;
|
||||
}
|
||||
|
||||
|
@@ -2857,6 +2857,17 @@ def Test_invalid_sid()
|
||||
delete('Xdidit')
|
||||
enddef
|
||||
|
||||
def Test_restoring_cpo()
|
||||
writefile(['vim9script', 'set nocp'], 'Xsourced')
|
||||
writefile(['call writefile(["done"], "Xdone")', 'quit!'], 'Xclose')
|
||||
if RunVim([], [], '-u NONE +"set cpo+=a" -S Xsourced -S Xclose')
|
||||
assert_equal(['done'], readfile('Xdone'))
|
||||
endif
|
||||
delete('Xsourced')
|
||||
delete('Xclose')
|
||||
enddef
|
||||
|
||||
|
||||
def Test_unset_any_variable()
|
||||
var lines =<< trim END
|
||||
var name: any
|
||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2122,
|
||||
/**/
|
||||
2121,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user