fix(window): crash when closing new curwin during CTRL-W_x (#41378)

Problem:  Crash when closing the new current window during CTRL-W_x.
Solution: Remove a duplicate redraw of a window that should normally be
          already mark for redraw in the previous call.
This commit is contained in:
zeertzjq
2026-08-19 20:13:08 +08:00
committed by GitHub
parent fce4d4502a
commit 2cd4229d01
2 changed files with 12 additions and 1 deletions

View File

@@ -741,6 +741,18 @@ describe('autocmd', function()
eq('flarb', fn.bufname())
end)
it('no use-after-free when closing new curwin during CTRL-W_x #41373', function()
exec([[
tabnew
vsplit
autocmd WinLeave * ++once bwipe!
]])
eq(2, #api.nvim_list_tabpages())
feed('<C-W>x')
eq(1, #api.nvim_list_tabpages())
assert_alive()
end)
it('does not ignore comma-separated patterns after a buffer-local pattern', function()
exec [[
edit baz " reuses buffer 1