Merge pull request #15215 from bfredl/fix_15212
fix(decorations): crash when :bdelete (extmark_free_all) after clear_namespace
This commit is contained in:
commit
98c4b2cf62
|
@ -268,7 +268,7 @@ bool extmark_clear(buf_T *buf, uint64_t ns_id,
|
||||||
}
|
}
|
||||||
ExtmarkNs *my_ns = all_ns ? buf_ns_ref(buf, item.ns_id, false) : ns;
|
ExtmarkNs *my_ns = all_ns ? buf_ns_ref(buf, item.ns_id, false) : ns;
|
||||||
map_del(uint64_t, uint64_t)(my_ns->map, item.mark_id);
|
map_del(uint64_t, uint64_t)(my_ns->map, item.mark_id);
|
||||||
map_del(uint64_t, ExtmarkItem)(buf->b_extmark_index, mark.id);
|
map_del(uint64_t, ExtmarkItem)(buf->b_extmark_index, start_id);
|
||||||
marktree_del_itr(buf->b_marktree, itr, false);
|
marktree_del_itr(buf->b_marktree, itr, false);
|
||||||
} else {
|
} else {
|
||||||
marktree_itr_next(buf->b_marktree, itr);
|
marktree_itr_next(buf->b_marktree, itr);
|
||||||
|
|
|
@ -697,4 +697,50 @@ end]]
|
||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
it('does not crash when deleting a cleared buffer #15212', function()
|
||||||
|
exec_lua [[
|
||||||
|
ns = vim.api.nvim_create_namespace("myplugin")
|
||||||
|
vim.api.nvim_buf_set_extmark(0, ns, 0, 0, {virt_text = {{"a"}}, end_col = 0})
|
||||||
|
]]
|
||||||
|
screen:expect{grid=[[
|
||||||
|
^ a |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
|
|
||||||
|
]]}
|
||||||
|
|
||||||
|
exec_lua [[
|
||||||
|
vim.api.nvim_buf_clear_namespace(0, ns, 0, -1)
|
||||||
|
vim.cmd("bdelete")
|
||||||
|
]]
|
||||||
|
screen:expect{grid=[[
|
||||||
|
^ |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
|
|
||||||
|
]]}
|
||||||
|
helpers.assert_alive()
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue