From 4ac6cc16fd54c12161b131e3b9bab0ac17dc4d01 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 7 Aug 2013 17:58:20 +0200 Subject: The close operation is actually async too. Meaning that the destroy operation probably should become async... --- src/BLua.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/BLua.cc') diff --git a/src/BLua.cc b/src/BLua.cc index e8c5ab6..73995c0 100644 --- a/src/BLua.cc +++ b/src/BLua.cc @@ -270,8 +270,7 @@ int Balau::LuaStatics::callwrap(lua_State * __L, lua_CFunction func) { int Balau::LuaStatics::collector(lua_State * __L) { Lua L(__L); LuaObjectBase * o = (LuaObjectBase *) L.touserdata(); - o->destroy(); - return 0; + return L.yield(Future([o]() { o->destroy(); return 0; })); } int Balau::LuaStatics::destructor(lua_State * __L) { @@ -279,12 +278,12 @@ int Balau::LuaStatics::destructor(lua_State * __L) { L.push("__obj"); L.copy(); L.gettable(-3, true); - collector(__L); + LuaObjectBase * o = (LuaObjectBase *) L.touserdata(); L.pop(); L.push(); L.settable(-3, true); L.pop(); - return 0; + return L.yield(Future([o]() { o->destroy(); return 0; })); } void Balau::Lua::setCallWrap(lua_CallWrapper wrapper) { -- cgit v1.2.3