mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 05:05:00 -07:00
fix(lua): do not schedule events if Nvim is exiting
If Nvim is in the process of exiting then we do not want to allocate any new refs onto the event loop, because they will not be freed and will result in a memory leak.
This commit is contained in:
parent
e7c46438ab
commit
22eb2ba183
@ -366,6 +366,12 @@ static void nlua_schedule_event(void **argv)
|
||||
static int nlua_schedule(lua_State *const lstate)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
// If Nvim is exiting don't schedule tasks to run in the future. Any refs
|
||||
// allocated here will not be cleaned up otherwise
|
||||
if (exiting) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lua_type(lstate, 1) != LUA_TFUNCTION) {
|
||||
lua_pushliteral(lstate, "vim.schedule: expected function");
|
||||
return lua_error(lstate);
|
||||
|
Loading…
Reference in New Issue
Block a user