summaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-06-21 13:41:34 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-06-21 13:41:34 -0300
commit777061e441ecbb9e3522aa5c88d9204decc9ff81 (patch)
treef974a57d8377be76b645de07f4c847dd6d15eaaf /lstate.c
parentfccadba4b54f8e13c8b9cfc97307f53931496936 (diff)
downloadlua-github-777061e441ecbb9e3522aa5c88d9204decc9ff81.tar.gz
resurect userdata before calling its GC tag method
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lstate.c b/lstate.c
index 65c1cde4..6c2c4c17 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
/*
-** $Id: lstate.c,v 1.63 2001/06/06 18:00:19 roberto Exp roberto $
+** $Id: lstate.c,v 1.64 2001/06/12 18:43:13 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@@ -112,12 +112,10 @@ static void close_state (lua_State *L, lua_State *OL) {
L->next->previous = L->previous;
}
else if (G(L)) { /* last thread; close global state */
- while (G(L)->rootudata) {
- luaC_collectudata(L); /* collect all user data */
- luaC_callgcTMudata(L); /* call their tag methods */
- } /* repeat, as tag methods may create new userdata objects */
- luaC_collect(L, 1); /* collect all other elements */
+ luaC_callallgcTM(L); /* call GC tag methods for all udata */
+ luaC_collect(L, 1); /* collect all elements */
lua_assert(G(L)->rootproto == NULL);
+ lua_assert(G(L)->rootudata == NULL);
lua_assert(G(L)->rootcl == NULL);
lua_assert(G(L)->roottable == NULL);
luaS_freeall(L);