diff options
-rw-r--r-- | lgc.h | 2 | ||||
-rw-r--r-- | lstate.c | 3 |
2 files changed, 3 insertions, 2 deletions
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | 17 | ||
18 | void luaC_callallgcTM (lua_State *L); | 18 | void luaC_callallgcTM (lua_State *L); |
19 | Udata *luaC_collect (lua_State *L, int all); | 19 | void luaC_collect (lua_State *L, int all); |
20 | void luaC_collectgarbage (lua_State *L); | 20 | void luaC_collectgarbage (lua_State *L); |
21 | 21 | ||
22 | 22 | ||
@@ -116,7 +116,8 @@ static void close_state (lua_State *L, lua_State *OL) { | |||
116 | L->next->previous = L->previous; | 116 | L->next->previous = L->previous; |
117 | } | 117 | } |
118 | else if (G(L)) { /* last thread; close global state */ | 118 | else if (G(L)) { /* last thread; close global state */ |
119 | luaC_callallgcTM(L); /* call GC tag methods for all udata */ | 119 | if (G(L)->rootudata) /* (avoid problems with incomplete states) */ |
120 | luaC_callallgcTM(L); /* call GC tag methods for all udata */ | ||
120 | luaC_collect(L, 1); /* collect all elements */ | 121 | luaC_collect(L, 1); /* collect all elements */ |
121 | lua_assert(G(L)->rootproto == NULL); | 122 | lua_assert(G(L)->rootproto == NULL); |
122 | lua_assert(G(L)->rootudata == NULL); | 123 | lua_assert(G(L)->rootudata == NULL); |