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>
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;
%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()
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1971,
/**/
1970,
/**/