aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/executor.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-11-17 18:34:48 +0800
committerGitHub <noreply@github.com>2023-11-17 18:34:48 +0800
commit20ec4c776a07492c2e3b995e10b40b1cdb52bc7a (patch)
treefae077048255d77f1768a51e0276ff3daee4373e /src/nvim/lua/executor.c
parentdc9f7b814517045b5354364655f660aae0989710 (diff)
downloadrneovim-20ec4c776a07492c2e3b995e10b40b1cdb52bc7a.tar.gz
rneovim-20ec4c776a07492c2e3b995e10b40b1cdb52bc7a.tar.bz2
rneovim-20ec4c776a07492c2e3b995e10b40b1cdb52bc7a.zip
fix(lua): only disable vim.schedule() when closing main loop (#26090)
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r--src/nvim/lua/executor.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index aed96a539a..12304b6f11 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -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,