0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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.
This commit is contained in:
Bram Moolenaar
2022-09-28 11:48:30 +01:00
parent caa1d19da1
commit ef976323e7
4 changed files with 24 additions and 1 deletions

View File

@@ -468,7 +468,12 @@ can_unload_buffer(buf_T *buf)
}
}
if (!can_unload)
semsg(_(e_attempt_to_delete_buffer_that_is_in_use_str), buf->b_fname);
{
char_u *fname = buf->b_fname != NULL ? buf->b_fname : buf->b_ffname;
semsg(_(e_attempt_to_delete_buffer_that_is_in_use_str),
fname != NULL ? fname : (char_u *)"[No Name]");
}
return can_unload;
}