mirror of
https://github.com/neovim/neovim.git
synced 2026-07-31 04:39:07 +00:00
fix(window): avoid UAF in close_windows (#40853)
This commit is contained in:
@@ -2503,6 +2503,20 @@ describe('api/buf', function()
|
||||
ok(not api.nvim_buf_is_loaded(b))
|
||||
ok(api.nvim_buf_is_valid(b))
|
||||
end)
|
||||
|
||||
it('does not crash if WinClosed closes the next tabpage #40852', function()
|
||||
exec_lua(function()
|
||||
vim.cmd.tabnew()
|
||||
vim.api.nvim_create_autocmd('WinClosed', {
|
||||
callback = function()
|
||||
pcall(vim.api.nvim_win_close, 0, true)
|
||||
end,
|
||||
})
|
||||
local bufs = vim.api.nvim_list_bufs()
|
||||
vim.api.nvim_buf_delete(bufs[#bufs - 1], { force = true })
|
||||
end)
|
||||
assert_alive()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('nvim_buf_get_mark', function()
|
||||
|
||||
Reference in New Issue
Block a user