Merge branch 'master' into v2.1

This commit is contained in:
Mike Pall
2025-11-10 18:18:19 +01:00

View File

@@ -377,6 +377,10 @@ void LJ_FASTCALL lj_state_free(global_State *g, lua_State *L)
lj_assertG(L != mainthread(g), "free of main thread"); lj_assertG(L != mainthread(g), "free of main thread");
if (obj2gco(L) == gcref(g->cur_L)) if (obj2gco(L) == gcref(g->cur_L))
setgcrefnull(g->cur_L); setgcrefnull(g->cur_L);
#if LJ_HASFFI
if (ctype_ctsG(g) && ctype_ctsG(g)->L == L) /* Avoid dangling cts->L. */
ctype_ctsG(g)->L = mainthread(g);
#endif
if (gcref(L->openupval) != NULL) { if (gcref(L->openupval) != NULL) {
lj_func_closeuv(L, tvref(L->stack)); lj_func_closeuv(L, tvref(L->stack));
lj_trace_abort(g); /* For aa_uref soundness. */ lj_trace_abort(g); /* For aa_uref soundness. */