mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.0097: crash with autocommand and spellfile
Problem: Crash with autocommand and spellfile. (Tim Pope) Solution: Do not pop exestack when not pushed. (closes #5450)
This commit is contained in:
parent
fbcdf671f0
commit
ce6db0273f
@ -352,6 +352,7 @@ spell_load_file(
|
|||||||
slang_T *lp = NULL;
|
slang_T *lp = NULL;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
int res;
|
int res;
|
||||||
|
int did_estack_push = FALSE;
|
||||||
|
|
||||||
fd = mch_fopen((char *)fname, "r");
|
fd = mch_fopen((char *)fname, "r");
|
||||||
if (fd == NULL)
|
if (fd == NULL)
|
||||||
@ -392,6 +393,7 @@ spell_load_file(
|
|||||||
|
|
||||||
// Set sourcing_name, so that error messages mention the file name.
|
// Set sourcing_name, so that error messages mention the file name.
|
||||||
estack_push(ETYPE_SPELL, fname, 0);
|
estack_push(ETYPE_SPELL, fname, 0);
|
||||||
|
did_estack_push = TRUE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* <HEADER>: <fileID>
|
* <HEADER>: <fileID>
|
||||||
@ -578,7 +580,8 @@ endFAIL:
|
|||||||
endOK:
|
endOK:
|
||||||
if (fd != NULL)
|
if (fd != NULL)
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
estack_pop();
|
if (did_estack_push)
|
||||||
|
estack_pop();
|
||||||
|
|
||||||
return lp;
|
return lp;
|
||||||
}
|
}
|
||||||
|
@ -2335,3 +2335,25 @@ func Test_BufWrite_lockmarks()
|
|||||||
call delete('Xtest')
|
call delete('Xtest')
|
||||||
call delete('Xtest2')
|
call delete('Xtest2')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_FileType_spell()
|
||||||
|
if !isdirectory('/tmp')
|
||||||
|
throw "Skipped: requires /tmp directory"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" this was crashing with an invalid free()
|
||||||
|
setglobal spellfile=/tmp/en.utf-8.add
|
||||||
|
augroup crash
|
||||||
|
autocmd!
|
||||||
|
autocmd BufNewFile,BufReadPost crashfile setf somefiletype
|
||||||
|
autocmd BufNewFile,BufReadPost crashfile set ft=anotherfiletype
|
||||||
|
autocmd FileType anotherfiletype setlocal spell
|
||||||
|
augroup END
|
||||||
|
func! NoCrash() abort
|
||||||
|
edit /tmp/crashfile
|
||||||
|
endfunc
|
||||||
|
call NoCrash()
|
||||||
|
|
||||||
|
au! crash
|
||||||
|
setglobal spellfile=
|
||||||
|
endfunc
|
||||||
|
@ -742,6 +742,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
97,
|
||||||
/**/
|
/**/
|
||||||
96,
|
96,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user