mirror of
https://github.com/neovim/neovim.git
synced 2026-04-01 13:22:08 +00:00
vim-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: vim/vim#18901
fe1c57cd2c
Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
@@ -479,6 +479,11 @@ static bool can_unload_buffer(buf_T *buf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Don't unload the buffer while it's still being saved
|
||||||
|
if (can_unload && buf->b_saving) {
|
||||||
|
can_unload = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!can_unload) {
|
if (!can_unload) {
|
||||||
char *fname = buf->b_fname != NULL ? buf->b_fname : buf->b_ffname;
|
char *fname = buf->b_fname != NULL ? buf->b_fname : buf->b_ffname;
|
||||||
semsg(_(e_attempt_to_delete_buffer_that_is_in_use_str),
|
semsg(_(e_attempt_to_delete_buffer_that_is_in_use_str),
|
||||||
|
|||||||
@@ -228,6 +228,13 @@ func Test_buffer_error()
|
|||||||
%bwipe
|
%bwipe
|
||||||
endfunc
|
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
|
" Test for the status messages displayed when unloading, deleting or wiping
|
||||||
" out buffers
|
" out buffers
|
||||||
func Test_buffer_statusmsg()
|
func Test_buffer_statusmsg()
|
||||||
|
|||||||
Reference in New Issue
Block a user