From e043b72a55493cde9bb9c19997a4d58bac444630 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 10 Dec 2001 20:11:23 -0200 Subject: simpler way to collect userdata --- lgc.h | 2 +- lstate.c | 3 ++- 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 @@ void luaC_callallgcTM (lua_State *L); -Udata *luaC_collect (lua_State *L, int all); +void luaC_collect (lua_State *L, int all); void luaC_collectgarbage (lua_State *L); 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) { L->next->previous = L->previous; } else if (G(L)) { /* last thread; close global state */ - luaC_callallgcTM(L); /* call GC tag methods for all udata */ + if (G(L)->rootudata) /* (avoid problems with incomplete states) */ + 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); -- cgit v1.2.3-55-g6feb