mirror of
https://github.com/vim/vim.git
synced 2025-12-13 20:36:39 +01:00
patch 9.1.1971: Crash when buffer gets deleted inside charconvert during save
Problem: Crash when buffer gets deleted inside charconvert during save
Solution: Check for `b_saving` inside `can_unload_buffer()`, so we don’t try to
unload a buffer while it’s still being saved (glepnir).
closes: #18901
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
fa3bdc2501
commit
fe1c57cd2c
@@ -516,6 +516,10 @@ can_unload_buffer(buf_T *buf)
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Don't unload the buffer while it's still being saved
|
||||
if (can_unload && buf->b_saving)
|
||||
can_unload = FALSE;
|
||||
|
||||
if (!can_unload)
|
||||
{
|
||||
char_u *fname = buf->b_fname != NULL ? buf->b_fname : buf->b_ffname;
|
||||
|
||||
@@ -226,6 +226,13 @@ func Test_buffer_error()
|
||||
%bwipe
|
||||
endfunc
|
||||
|
||||
func Test_bwipe_during_save()
|
||||
set charconvert=execute('%bw!')
|
||||
call assert_fails('write ++enc=lmao boom', 'E937:')
|
||||
|
||||
%bwipe
|
||||
endfunc
|
||||
|
||||
" Test for the status messages displayed when unloading, deleting or wiping
|
||||
" out buffers
|
||||
func Test_buffer_statusmsg()
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1971,
|
||||
/**/
|
||||
1970,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user