From a645737366f45e17625757f0de06cc7fc0d4909e Mon Sep 17 00:00:00 2001 From: actboy168 Date: Tue, 2 Apr 2024 10:35:30 +0800 Subject: [PATCH] fixes bug --- .vscode/settings.json | 6 ------ 3rd/lua/lua54/lcorolib.c | 4 ---- 3rd/lua/lua54/lstate.c | 2 ++ 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 2acd7ec71..dcc0c3cc7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,9 +1,3 @@ { - "[c]": { - "editor.formatOnSave": true, - }, - "[cpp]": { - "editor.formatOnSave": true, - }, "C_Cpp.autoAddFileAssociations": false, } \ No newline at end of file diff --git a/3rd/lua/lua54/lcorolib.c b/3rd/lua/lua54/lcorolib.c index 2ca5a1378..d6ccd3c0d 100644 --- a/3rd/lua/lua54/lcorolib.c +++ b/3rd/lua/lua54/lcorolib.c @@ -78,9 +78,7 @@ static int luaB_auxwrap (lua_State *L) { if (l_unlikely(r < 0)) { /* error? */ int stat = lua_status(co); if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */ - luai_threadcall(co, L); stat = lua_closethread(co, L); /* close its tbc variables */ - luai_threadret(L, co); lua_assert(stat != LUA_OK); lua_xmove(co, L, 1); /* move error message to the caller */ } @@ -176,9 +174,7 @@ static int luaB_close (lua_State *L) { int status = auxstatus(L, co); switch (status) { case COS_DEAD: case COS_YIELD: { - luai_threadcall(co, L); status = lua_closethread(co, L); - luai_threadret(L, co); if (status == LUA_OK) { lua_pushboolean(L, 1); return 1; diff --git a/3rd/lua/lua54/lstate.c b/3rd/lua/lua54/lstate.c index 1e925e5ad..0aac8e3f5 100644 --- a/3rd/lua/lua54/lstate.c +++ b/3rd/lua/lua54/lstate.c @@ -342,8 +342,10 @@ int luaE_resetthread (lua_State *L, int status) { LUA_API int lua_closethread (lua_State *L, lua_State *from) { int status; lua_lock(L); + luai_threadcall(L, from); L->nCcalls = (from) ? getCcalls(from) : 0; status = luaE_resetthread(L, L->status); + luai_threadret(from, L); lua_unlock(L); return status; }