comparison src/buffer.c @ 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 a4eab0d846dc
children 37aa9fd2ed72
comparison
equal deleted inserted replaced
30557:cb23c106452e 30558:8e73ecbee60d
466 can_unload = FALSE; 466 can_unload = FALSE;
467 break; 467 break;
468 } 468 }
469 } 469 }
470 if (!can_unload) 470 if (!can_unload)
471 semsg(_(e_attempt_to_delete_buffer_that_is_in_use_str), buf->b_fname); 471 {
472 char_u *fname = buf->b_fname != NULL ? buf->b_fname : buf->b_ffname;
473
474 semsg(_(e_attempt_to_delete_buffer_that_is_in_use_str),
475 fname != NULL ? fname : (char_u *)"[No Name]");
476 }
472 return can_unload; 477 return can_unload;
473 } 478 }
474 479
475 /* 480 /*
476 * Close the link to a buffer. 481 * Close the link to a buffer.