mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
Restore cur_L for specific Lua/C API use case.
Thanks to Peter Cawley. #1066
This commit is contained in:
parent
b8919781d4
commit
e86990f7f2
@ -174,12 +174,15 @@ static void *err_unwind(lua_State *L, void *stopcf, int errcode)
|
|||||||
case FRAME_PCALL: /* FF pcall() frame. */
|
case FRAME_PCALL: /* FF pcall() frame. */
|
||||||
case FRAME_PCALLH: /* FF pcall() frame inside hook. */
|
case FRAME_PCALLH: /* FF pcall() frame inside hook. */
|
||||||
if (errcode) {
|
if (errcode) {
|
||||||
|
global_State *g;
|
||||||
if (errcode == LUA_YIELD) {
|
if (errcode == LUA_YIELD) {
|
||||||
frame = frame_prevd(frame);
|
frame = frame_prevd(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g = G(L);
|
||||||
|
setgcref(g->cur_L, obj2gco(L));
|
||||||
if (frame_typep(frame) == FRAME_PCALL)
|
if (frame_typep(frame) == FRAME_PCALL)
|
||||||
hook_leave(G(L));
|
hook_leave(g);
|
||||||
L->base = frame_prevd(frame) + 1;
|
L->base = frame_prevd(frame) + 1;
|
||||||
L->cframe = cf;
|
L->cframe = cf;
|
||||||
unwindstack(L, L->base);
|
unwindstack(L, L->base);
|
||||||
|
Loading…
Reference in New Issue
Block a user