diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2013-08-06 03:43:16 +0200 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2013-08-06 03:43:16 +0200 |
commit | ff9046f7092dfef012f39785131803e359394660 (patch) | |
tree | a653dbab6b0c40a6382e63a1c1dff71e2be256af | |
parent | cd5da6097812baf125c2dc4f1d12e1a3f4985464 (diff) |
Using shared_ptr instead of rolling our own system, making it more pretty.
-rw-r--r-- | src/BLua.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/BLua.cc b/src/BLua.cc index 247a8ab..e8c5ab6 100644 --- a/src/BLua.cc +++ b/src/BLua.cc @@ -1,3 +1,4 @@ +#include <memory> #include <stdlib.h> #include "BLua.h" #include "Printer.h" @@ -97,15 +98,14 @@ int Balau::LuaStatics::dumpvars(lua_State * __L) { IO<Handle> s(new Buffer()); L.dumpvars(h, prefix); Task * t = new CopyTask(s, h); - Events::TaskEvent * evt = new Events::TaskEvent(t); + std::shared_ptr<Events::TaskEvent> evt(new Events::TaskEvent(t)); return L.yield(Future<int>([evt, s]() mutable { for (;;) { if (evt->gotSignal()) { evt->ack(); - delete evt; s->close(); } else { - Task::operationYield(evt, Task::INTERRUPTIBLE); + Task::operationYield(evt.get(), Task::INTERRUPTIBLE); } } return 0; |