diff options
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 1.119 2003/02/10 17:32:50 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.120 2003/02/13 16:07:57 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -206,9 +206,14 @@ static void callallgcTM (lua_State *L, void *ud) { | |||
206 | LUA_API void lua_close (lua_State *L) { | 206 | LUA_API void lua_close (lua_State *L) { |
207 | lua_lock(L); | 207 | lua_lock(L); |
208 | L = G(L)->mainthread; /* only the main thread can be closed */ | 208 | L = G(L)->mainthread; /* only the main thread can be closed */ |
209 | luaF_close(L, L->stack); /* close all upvalues for this thread */ | ||
209 | luaC_separateudata(L); /* separate udata that have GC metamethods */ | 210 | luaC_separateudata(L); /* separate udata that have GC metamethods */ |
210 | /* repeat until no more errors */ | 211 | L->errfunc = 0; /* no error function during GC metamethods */ |
211 | while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0) /* skip */; | 212 | do { /* repeat until no more errors */ |
213 | L->ci = L->base_ci; | ||
214 | L->base = L->top = L->ci->base; | ||
215 | L->nCcalls = 0; | ||
216 | } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0); | ||
212 | lua_assert(G(L)->tmudata == NULL); | 217 | lua_assert(G(L)->tmudata == NULL); |
213 | close_state(L); | 218 | close_state(L); |
214 | } | 219 | } |