aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-10 20:11:23 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-12-10 20:11:23 -0200
commite043b72a55493cde9bb9c19997a4d58bac444630 (patch)
treef3ed54ec1dcead65454931ad2a86ebb2a3ea3a15
parenta4c35a3269f0581da212b3c4abd04989f88425ce (diff)
downloadlua-e043b72a55493cde9bb9c19997a4d58bac444630.tar.gz
lua-e043b72a55493cde9bb9c19997a4d58bac444630.tar.bz2
lua-e043b72a55493cde9bb9c19997a4d58bac444630.zip
simpler way to collect userdata
-rw-r--r--lgc.h2
-rw-r--r--lstate.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/lgc.h b/lgc.h
index a5baebcb..aa76ab11 100644
--- a/lgc.h
+++ b/lgc.h
@@ -16,7 +16,7 @@
16 16
17 17
18void luaC_callallgcTM (lua_State *L); 18void luaC_callallgcTM (lua_State *L);
19Udata *luaC_collect (lua_State *L, int all); 19void luaC_collect (lua_State *L, int all);
20void luaC_collectgarbage (lua_State *L); 20void luaC_collectgarbage (lua_State *L);
21 21
22 22
diff --git a/lstate.c b/lstate.c
index 7777b7a1..35518cbc 100644
--- a/lstate.c
+++ b/lstate.c
@@ -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);