diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-28 23:13:15 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-28 23:13:15 +0200 |
commit | d569a9e74684cd17f9cea63e804281388728e513 (patch) | |
tree | 6880a6a0ecdf0023a5ac75a25913294ccad86f16 | |
parent | 4934ad0e448bfa03ba19c7c5b411c457a9910442 (diff) | |
download | vim-git-d569a9e74684cd17f9cea63e804281388728e513.tar.gz |
patch 8.2.1770: invalid memory use when using SpellFileMissing autocmdv8.2.1770
Problem: Invalid memory use when using SpellFileMissing autocmd.
Solution: Add test case. (Dominique Pellé, closes #7036) Fix using a window
that was closed.
-rw-r--r-- | src/spell.c | 2 | ||||
-rw-r--r-- | src/testdir/test_spell.vim | 23 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 26 insertions, 1 deletions
diff --git a/src/spell.c b/src/spell.c index 6b431fa5b..085f3177c 100644 --- 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; } diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim index db40cd24a..dd68e0c09 100644 --- 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() diff --git a/src/version.c b/src/version.c index 3d37c85bc..26e63c2bd 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 */ /**/ + 1770, +/**/ 1769, /**/ 1768, |