mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.0882: using freed memory after SpellFileMissing autocmd uses bwipe (#21060)
Problem: Using freed memory after SpellFileMissing autocmd uses bwipe.
Solution: Bail out if the window no longer exists.
c3d27ada14
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
2685d27cd6
commit
7439973851
@ -110,6 +110,7 @@
|
|||||||
#include "nvim/types.h" // for char_u
|
#include "nvim/types.h" // for char_u
|
||||||
#include "nvim/undo.h" // for u_save_cursor
|
#include "nvim/undo.h" // for u_save_cursor
|
||||||
#include "nvim/vim.h" // for curwin, strlen, STRLCPY, STRNCMP
|
#include "nvim/vim.h" // for curwin, strlen, STRLCPY, STRNCMP
|
||||||
|
#include "nvim/window.h" // for win_valid_any_tab
|
||||||
|
|
||||||
// Result values. Lower number is accepted over higher one.
|
// Result values. Lower number is accepted over higher one.
|
||||||
enum {
|
enum {
|
||||||
@ -1965,8 +1966,8 @@ char *did_set_spelllang(win_T *wp)
|
|||||||
} else {
|
} else {
|
||||||
spell_load_lang((char_u *)lang);
|
spell_load_lang((char_u *)lang);
|
||||||
// SpellFileMissing autocommands may do anything, including
|
// SpellFileMissing autocommands may do anything, including
|
||||||
// destroying the buffer we are using...
|
// destroying the buffer we are using or closing the window.
|
||||||
if (!bufref_valid(&bufref)) {
|
if (!bufref_valid(&bufref) || !win_valid_any_tab(wp)) {
|
||||||
ret_msg = N_("E797: SpellFileMissing autocommand deleted buffer");
|
ret_msg = N_("E797: SpellFileMissing autocommand deleted buffer");
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,19 @@ func Test_spell_file_missing()
|
|||||||
%bwipe!
|
%bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_spell_file_missing_bwipe()
|
||||||
|
" this was using a window that was wiped out in a SpellFileMissing autocmd
|
||||||
|
set spelllang=xy
|
||||||
|
au SpellFileMissing * n0
|
||||||
|
set spell
|
||||||
|
au SpellFileMissing * bw
|
||||||
|
snext somefile
|
||||||
|
|
||||||
|
au! SpellFileMissing
|
||||||
|
bwipe!
|
||||||
|
set nospell spelllang=en
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_spelldump()
|
func Test_spelldump()
|
||||||
" In case the spell file is not found avoid getting the download dialog, we
|
" In case the spell file is not found avoid getting the download dialog, we
|
||||||
" would get stuck at the prompt.
|
" would get stuck at the prompt.
|
||||||
|
Loading…
Reference in New Issue
Block a user