From b1e8c832653e00107a2b587df398a02999e21a9a Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 23 Jan 2008 17:41:10 +0000 Subject: Trying to reduce VM leaks. --- lib/LuaTask.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/LuaTask.cc') diff --git a/lib/LuaTask.cc b/lib/LuaTask.cc index 0acd392..12f1db5 100644 --- a/lib/LuaTask.cc +++ b/lib/LuaTask.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: LuaTask.cc,v 1.25 2008-01-22 10:51:18 pixel Exp $ */ +/* $Id: LuaTask.cc,v 1.26 2008-01-23 17:41:10 pixel Exp $ */ #include #include @@ -34,7 +34,7 @@ htab * LuaTask::h = hcreate(1); -LuaTask::LuaTask(Lua * __L, const String & _cmd) : L(__L), cmd(_cmd), nargs(0), c(0), b(0) { +LuaTask::LuaTask(Lua * __L, const String & _cmd, bool _destroy_VM) : L(__L), cmd(_cmd), nargs(0), c(0), b(0), destroy_VM(_destroy_VM) { LuaTask * top = gettop(); if (top) { @@ -46,7 +46,7 @@ LuaTask::LuaTask(Lua * __L, const String & _cmd) : L(__L), cmd(_cmd), nargs(0), stacktop = L->gettop() + 1; } -LuaTask::LuaTask(Lua * __L, int _nargs) throw (GeneralException) : L(__L), cmd(""), nargs(_nargs), c(0), b(0) { +LuaTask::LuaTask(Lua * __L, int _nargs, bool _destroy_VM) throw (GeneralException) : L(__L), cmd(""), nargs(_nargs), c(0), b(0), destroy_VM(_destroy_VM) { if (gettop()) throw GeneralException("Can't run a stack-based LuaTask when there are other tasks waiting."); @@ -59,6 +59,8 @@ LuaTask::~LuaTask() { if (gettop() == this) { settop(0); } + if (destroy_VM) + delete L; } LuaTask * LuaTask::gettop() { -- cgit v1.2.3