diff options
Diffstat (limited to 'src')
-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; |