From f3dfa53a3efd9a1efabe5d0afca94239cfffffe7 Mon Sep 17 00:00:00 2001 From: pixel Date: Thu, 12 Jul 2007 11:28:32 +0000 Subject: Last patch seems to work fine - let's try to be a bit nicer with the memory now. --- lib/BLua.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/BLua.cc b/lib/BLua.cc index 517955b..a33866f 100644 --- a/lib/BLua.cc +++ b/lib/BLua.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.cc,v 1.50 2007-06-17 15:13:46 pixel Exp $ */ +/* $Id: BLua.cc,v 1.51 2007-07-12 11:28:32 pixel Exp $ */ #include #include "BLua.h" @@ -465,6 +465,16 @@ Lua::~Lua() { if (!_is_thread) { lua_setgcthreshold(L, 0); lua_close(L); + } else { + push(); // -1 = nil + push("BLUA_THREADS"); // -2 = nil, -1 = "BLUA_THREADS" + copy(); // -3 = nil, -2 = "BLUA_THREADS", -1 = "BLUA_THREADS" + gettable(LUA_REGISTRYINDEX); // -3 = nil, -2 = "BLUA_THREADS", -1 = BLUA_THREADS + push((lua_Number) IntPoint(Lt)); // -4 = nil, -3 = "BLUA_THREADS", -2 = BLUA_THREADS, -1 = key-Lt + copy(-4); // -5 = nil, -4 = "BLUA_THREADS", -3 = BLUA_THREADS, -2 = key-Lt, -1 = thread + settable(); // -3 = nil, -2 = "BLUA_THREADS", -1 = BLUA_THREADS + settable(LUA_REGISTRYINDEX); // -1 = thread + pop(); } L = 0; -- cgit v1.2.3