summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2006-05-24 11:15:50 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2006-05-24 11:15:50 -0300
commitc408158047c24879887379d2f0cec71fd30604cb (patch)
tree14568f635ae6c778f243e844f3cc28497abe919a
parent55e323190eda0aac78c4cd13ba70c7f13d6f248b (diff)
downloadlua-github-c408158047c24879887379d2f0cec71fd30604cb.tar.gz
only destroy state after running all finalizers
-rw-r--r--lstate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lstate.c b/lstate.c
index ed40bee7..8da02ed5 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
/*
-** $Id: lstate.c,v 2.34 2005/09/20 17:55:53 roberto Exp roberto $
+** $Id: lstate.c,v 2.35 2005/10/06 20:46:25 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@@ -198,7 +198,6 @@ static void callallgcTM (lua_State *L, void *ud) {
LUA_API void lua_close (lua_State *L) {
L = G(L)->mainthread; /* only the main thread can be closed */
- luai_userstateclose(L);
lua_lock(L);
luaF_close(L, L->stack); /* close all upvalues for this thread */
luaC_separateudata(L, 1); /* separate udata that have GC metamethods */
@@ -209,6 +208,7 @@ LUA_API void lua_close (lua_State *L) {
L->nCcalls = 0;
} while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0);
lua_assert(G(L)->tmudata == NULL);
+ luai_userstateclose(L);
close_state(L);
}