diff options
author | notomo <notomo.motono@gmail.com> | 2022-09-16 18:06:37 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-16 11:06:37 +0200 |
commit | 754822a066e6ce92462aa17fce8999472c23b777 (patch) | |
tree | a58d8cf6c47224eee69df4a84b085435de6081e3 | |
parent | 0c0071548b4b598dcc4f9836703b1a7b0dc7c007 (diff) | |
download | rneovim-754822a066e6ce92462aa17fce8999472c23b777.tar.gz rneovim-754822a066e6ce92462aa17fce8999472c23b777.tar.bz2 rneovim-754822a066e6ce92462aa17fce8999472c23b777.zip |
fix(lua): free vim.ui_attach callback before lua close (#20205)
-rw-r--r-- | src/nvim/memory.c | 2 | ||||
-rw-r--r-- | test/functional/lua/ui_event_spec.lua | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/nvim/memory.c b/src/nvim/memory.c index 03cfde6160..61c43d8f99 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -821,9 +821,9 @@ void free_all_mem(void) decor_free_all_mem(); - nlua_free_all_mem(); ui_free_all_mem(); ui_comp_free_all_mem(); + nlua_free_all_mem(); // should be last, in case earlier free functions deallocates arenas arena_free_reuse_blks(); diff --git a/test/functional/lua/ui_event_spec.lua b/test/functional/lua/ui_event_spec.lua index 294222ad13..57ffcf7b4e 100644 --- a/test/functional/lua/ui_event_spec.lua +++ b/test/functional/lua/ui_event_spec.lua @@ -105,4 +105,16 @@ describe('vim.ui_attach', function() } 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) |