diff src/testdir/test_autocmd.vim @ 30558:8e73ecbee60d v9.0.0614

patch 9.0.0614: SpellFileMissing autocmd may delete buffer Commit: https://github.com/vim/vim/commit/ef976323e770315b5fca544efb6b2faa25674d15 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 28 11:48:30 2022 +0100 patch 9.0.0614: SpellFileMissing autocmd may delete buffer Problem: SpellFileMissing autocmd may delete buffer. Solution: Disallow deleting the current buffer to avoid using freed memory.
author Bram Moolenaar <Bram@vim.org>
date Wed, 28 Sep 2022 13:00:04 +0200
parents 7ab65e398be7
children ac908e454519
line wrap: on
line diff
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -2880,6 +2880,16 @@ func Test_FileType_spell()
   setglobal spellfile=
 endfunc
 
+" this was wiping out the current buffer and using freed memory
+func Test_SpellFileMissing_bwipe()
+  next 0
+  au SpellFileMissing 0 bwipe
+  call assert_fails('set spell spelllang=0', 'E937:')
+
+  au! SpellFileMissing
+  bwipe
+endfunc
+
 " Test closing a window or editing another buffer from a FileChangedRO handler
 " in a readonly buffer
 func Test_FileChangedRO_winclose()