From: Mike Pall Date: Thu, 21 Sep 2023 01:54:08 +0000 (+0200) Subject: Restore cur_L for specific Lua/C API use case. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e86990f7f24a94b0897061f25a84547fe1108bed;p=thirdparty%2FLuaJIT.git Restore cur_L for specific Lua/C API use case. Thanks to Peter Cawley. #1066 --- diff --git a/src/lj_err.c b/src/lj_err.c index cadc76bd..7b11e4d0 100644 --- a/src/lj_err.c +++ b/src/lj_err.c @@ -174,12 +174,15 @@ static void *err_unwind(lua_State *L, void *stopcf, int errcode) case FRAME_PCALL: /* FF pcall() frame. */ case FRAME_PCALLH: /* FF pcall() frame inside hook. */ if (errcode) { + global_State *g; if (errcode == LUA_YIELD) { frame = frame_prevd(frame); break; } + g = G(L); + setgcref(g->cur_L, obj2gco(L)); if (frame_typep(frame) == FRAME_PCALL) - hook_leave(G(L)); + hook_leave(g); L->base = frame_prevd(frame) + 1; L->cframe = cf; unwindstack(L, L->base);