patch 9.2.0882: :bwipe crashes if WinLeave wipes all other buffers
Commit:
https://github.com/vim/vim/commit/3e4019a082701f48bb44de0cc7a92f6a3077bd4e
Author: zeertzjq <
zeer...@outlook.com>
Date: Fri Jul 31 18:07:40 2026 +0000
patch 9.2.0882: :bwipe crashes if WinLeave wipes all other buffers
Problem: :bwipe crashes if WinLeave wipes all other buffers
(after 9.1.2068).
Solution: Check for NULL pointer.
related: neovim/neovim#41066
closes: #20888
Signed-off-by: zeertzjq <
zeer...@outlook.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/buffer.c b/src/buffer.c
index 48a6bdc3d..c33c3efa0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1653,7 +1653,8 @@ do_buffer_ext(
buf = curbuf->b_next;
else
buf = curbuf->b_prev;
- if (bt_quickfix(buf) || (buf != curbuf && buf->b_locked_split))
+ if (bt_quickfix(buf)
+ || (buf != NULL && buf != curbuf && buf->b_locked_split))
buf = NULL;
}
}
diff --git a/src/testdir/test_buffer.vim b/src/testdir/test_buffer.vim
index 733ef6543..a8b6e8bd6 100644
--- a/src/testdir/test_buffer.vim
+++ b/src/testdir/test_buffer.vim
@@ -935,6 +935,13 @@ func Test_split_window_in_BufLeave_from_switching_buffer()
bwipe! Xb
endfunc
+func Test_wipe_other_buffers_in_WinLeave_from_bwipe()
+ tabnew
+ autocmd WinLeave * ++once 1,$-1bwipe!
+ " This should not crash
+ $bwipe!
+endfunc
+
" Switch to a buffer whose name contains '%' via completion (#20529).
func Test_buffer_switch_to_name_with_percent()
CheckMSWindows
diff --git a/src/version.c b/src/version.c
index 7f650d214..e7c89e818 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 882,
/**/
881,
/**/