summaryrefslogtreecommitdiff
path: root/lib/LuaTask.cc
diff options
context:
space:
mode:
authorpixel <pixel>2008-01-23 17:41:10 +0000
committerpixel <pixel>2008-01-23 17:41:10 +0000
commitb1e8c832653e00107a2b587df398a02999e21a9a (patch)
tree041ec488cfa682f8725eda812566f3b9137a8d28 /lib/LuaTask.cc
parent886ad8e7a9606bbdbac9d45d1398951d6b6a1910 (diff)
Trying to reduce VM leaks.
Diffstat (limited to 'lib/LuaTask.cc')
-rw-r--r--lib/LuaTask.cc8
1 files changed, 5 insertions, 3 deletions
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 <LuaTask.h>
#include <LuaHandle.h>
@@ -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() {