fix(lua): free vim.ui_attach callback before lua close (#20205)

This commit is contained in:
notomo 2022-09-16 18:06:37 +09:00 committed by GitHub
parent 0c0071548b
commit 754822a066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -821,9 +821,9 @@ void free_all_mem(void)
decor_free_all_mem(); decor_free_all_mem();
nlua_free_all_mem();
ui_free_all_mem(); ui_free_all_mem();
ui_comp_free_all_mem(); ui_comp_free_all_mem();
nlua_free_all_mem();
// should be last, in case earlier free functions deallocates arenas // should be last, in case earlier free functions deallocates arenas
arena_free_reuse_blks(); arena_free_reuse_blks();

View File

@ -105,4 +105,16 @@ describe('vim.ui_attach', function()
} }
end) end)
it('does not crash on exit', function()
helpers.funcs.system({
helpers.nvim_prog,
'-u', 'NONE',
'-i', 'NONE',
'--cmd', [[ lua ns = vim.api.nvim_create_namespace 'testspace' ]],
'--cmd', [[ lua vim.ui_attach(ns, {ext_popupmenu=true}, function() end) ]],
'--cmd', 'quitall!',
})
eq(0, helpers.eval('v:shell_error'))
end)
end) end)