aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-03-27 10:33:05 +0800
committerGitHub <noreply@github.com>2022-03-27 10:33:05 +0800
commit71b4c30ad6215742ffcb8dfb0fb4df899065cb7a (patch)
treeb4367538dee666321835525be7c5634d26f8fea9 /src/nvim/buffer.c
parenta490db5ba819218e9188cbb51d885dbf3a194000 (diff)
parentae0a43ec23d9d902d2d9c446dda592873988ea50 (diff)
downloadrneovim-71b4c30ad6215742ffcb8dfb0fb4df899065cb7a.tar.gz
rneovim-71b4c30ad6215742ffcb8dfb0fb4df899065cb7a.tar.bz2
rneovim-71b4c30ad6215742ffcb8dfb0fb4df899065cb7a.zip
Merge pull request #17877 from zeertzjq/vim-8.2.4631
vim-patch:8.2.4631: crash when switching window in BufWipeout autocommand
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 4ca752e747..bf592a626d 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -590,6 +590,10 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last)
// Remove the buffer from the list.
if (wipe_buf) {
+ // Do not wipe out the buffer if it is used in a window.
+ if (buf->b_nwindows > 0) {
+ return false;
+ }
if (buf->b_sfname != buf->b_ffname) {
XFREE_CLEAR(buf->b_sfname);
} else {