diff options
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 1.63 2001/06/06 18:00:19 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.64 2001/06/12 18:43:13 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 | */ |
@@ -112,12 +112,10 @@ static void close_state (lua_State *L, lua_State *OL) { | |||
112 | L->next->previous = L->previous; | 112 | L->next->previous = L->previous; |
113 | } | 113 | } |
114 | else if (G(L)) { /* last thread; close global state */ | 114 | else if (G(L)) { /* last thread; close global state */ |
115 | while (G(L)->rootudata) { | 115 | luaC_callallgcTM(L); /* call GC tag methods for all udata */ |
116 | luaC_collectudata(L); /* collect all user data */ | 116 | luaC_collect(L, 1); /* collect all elements */ |
117 | luaC_callgcTMudata(L); /* call their tag methods */ | ||
118 | } /* repeat, as tag methods may create new userdata objects */ | ||
119 | luaC_collect(L, 1); /* collect all other elements */ | ||
120 | lua_assert(G(L)->rootproto == NULL); | 117 | lua_assert(G(L)->rootproto == NULL); |
118 | lua_assert(G(L)->rootudata == NULL); | ||
121 | lua_assert(G(L)->rootcl == NULL); | 119 | lua_assert(G(L)->rootcl == NULL); |
122 | lua_assert(G(L)->roottable == NULL); | 120 | lua_assert(G(L)->roottable == NULL); |
123 | luaS_freeall(L); | 121 | luaS_freeall(L); |