mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 15:08:35 +00:00
fix(buffer): disable buffer-updates before removing from window #18933
There can be other places that access window buffer info (e.g. `tabpagebuflist()`), so checking `w_closing` in `win_findbuf()` doesn't solve the crash in all cases, and may also cause Nvim's behavior to diverge from Vim. Fix #14998
This commit is contained in:
@@ -252,9 +252,8 @@ describe('lua buffer event callbacks: on_lines', function()
|
||||
eq(2, meths.win_get_cursor(0)[1])
|
||||
end)
|
||||
|
||||
it('does not SEGFAULT when calling win_findbuf in on_detach', function()
|
||||
|
||||
exec_lua[[
|
||||
it('does not SEGFAULT when accessing window buffer info in on_detach #14998', function()
|
||||
local code = [[
|
||||
local buf = vim.api.nvim_create_buf(false, false)
|
||||
|
||||
vim.cmd"split"
|
||||
@@ -262,13 +261,19 @@ describe('lua buffer event callbacks: on_lines', function()
|
||||
|
||||
vim.api.nvim_buf_attach(buf, false, {
|
||||
on_detach = function(_, buf)
|
||||
vim.fn.tabpagebuflist()
|
||||
vim.fn.win_findbuf(buf)
|
||||
end
|
||||
})
|
||||
]]
|
||||
|
||||
exec_lua(code)
|
||||
command("q!")
|
||||
helpers.assert_alive()
|
||||
|
||||
exec_lua(code)
|
||||
command("bd!")
|
||||
helpers.assert_alive()
|
||||
end)
|
||||
|
||||
it('#12718 lnume', function()
|
||||
|
Reference in New Issue
Block a user