mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Ensure running __gc of userdata created in __gc at state close.
This commit is contained in:
parent
d621a6ccc2
commit
e14b6346b4
@ -242,12 +242,17 @@ LUA_API void lua_close(lua_State *L)
|
||||
G2J(g)->state = LJ_TRACE_IDLE;
|
||||
lj_dispatch_update(g);
|
||||
#endif
|
||||
do {
|
||||
for (;;) {
|
||||
hook_enter(g);
|
||||
L->status = 0;
|
||||
L->cframe = NULL;
|
||||
L->base = L->top = tvref(L->stack) + 1;
|
||||
} while (lj_vm_cpcall(L, NULL, NULL, cpfinalize) != 0);
|
||||
if (lj_vm_cpcall(L, NULL, NULL, cpfinalize) == 0) {
|
||||
lj_gc_separateudata(g, 1); /* Separate udata again. */
|
||||
if (gcref(g->gc.mmudata) == NULL) /* Until nothing is left to do. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
close_state(L);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user