diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lj_state.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lj_state.c b/src/lj_state.c index ecf15198..18a55e72 100644 --- a/src/lj_state.c +++ b/src/lj_state.c | |||
| @@ -304,6 +304,10 @@ lua_State *lj_state_new(lua_State *L) | |||
| 304 | void LJ_FASTCALL lj_state_free(global_State *g, lua_State *L) | 304 | void LJ_FASTCALL lj_state_free(global_State *g, lua_State *L) |
| 305 | { | 305 | { |
| 306 | lua_assert(L != mainthread(g)); | 306 | lua_assert(L != mainthread(g)); |
| 307 | #if LJ_HASFFI | ||
| 308 | if (ctype_ctsG(g) && ctype_ctsG(g)->L == L) /* Avoid dangling cts->L. */ | ||
| 309 | ctype_ctsG(g)->L = mainthread(g); | ||
| 310 | #endif | ||
| 307 | lj_func_closeuv(L, tvref(L->stack)); | 311 | lj_func_closeuv(L, tvref(L->stack)); |
| 308 | lua_assert(gcref(L->openupval) == NULL); | 312 | lua_assert(gcref(L->openupval) == NULL); |
| 309 | lj_mem_freevec(g, tvref(L->stack), L->stacksize, TValue); | 313 | lj_mem_freevec(g, tvref(L->stack), L->stacksize, TValue); |
