mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
fix(lua): only disable vim.schedule() when closing main loop (#26090)
This commit is contained in:
@@ -366,17 +366,17 @@ 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);
|
||||
}
|
||||
|
||||
// If main_loop is closing don't schedule tasks to run in the future,
|
||||
// otherwise any refs allocated here will not be cleaned up.
|
||||
if (main_loop.closing) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
LuaRef cb = nlua_ref_global(lstate, 1);
|
||||
|
||||
multiqueue_put(main_loop.events, nlua_schedule_event,
|
||||
|
Reference in New Issue
Block a user