Mercurial > vim
changeset 22444:9f4c3e20b5f7 v8.2.1770
patch 8.2.1770: invalid memory use when using SpellFileMissing autocmd
Commit: https://github.com/vim/vim/commit/d569a9e74684cd17f9cea63e804281388728e513
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 28 23:13:15 2020 +0200
patch 8.2.1770: invalid memory use when using SpellFileMissing autocmd
Problem: Invalid memory use when using SpellFileMissing autocmd.
Solution: Add test case. (Dominique Pell?, closes https://github.com/vim/vim/issues/7036) Fix using a window
that was closed.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 28 Sep 2020 23:15:03 +0200 |
parents | db8b2b99f59e |
children | 644505c61eb0 |
files | src/spell.c src/testdir/test_spell.vim src/version.c |
diffstat | 3 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/spell.c +++ b/src/spell.c @@ -2280,11 +2280,11 @@ did_set_spelllang(win_T *wp) } } } + redraw_win_later(wp, NOT_VALID); theend: vim_free(spl_copy); recursive = FALSE; - redraw_win_later(wp, NOT_VALID); return ret_msg; }
--- a/src/testdir/test_spell.vim +++ b/src/testdir/test_spell.vim @@ -120,6 +120,29 @@ foobar/? set spell& endfunc +func Test_spell_file_missing() + let s:spell_file_missing = 0 + augroup TestSpellFileMissing + autocmd! SpellFileMissing * let s:spell_file_missing += 1 + augroup END + + set spell spelllang=ab_cd + let messages = GetMessages() + call assert_equal('Warning: Cannot find word list "ab.utf-8.spl" or "ab.ascii.spl"', messages[-1]) + call assert_equal(1, s:spell_file_missing) + + new XTestSpellFileMissing + augroup TestSpellFileMissing + autocmd! SpellFileMissing * bwipe + augroup END + call assert_fails('set spell spelllang=ab_cd', 'E797:') + + augroup! TestSpellFileMissing + unlet s:spell_file_missing + set spell& spelllang& + %bwipe! +endfunc + func Test_spelllang_inv_region() set spell spelllang=en_xx let messages = GetMessages()