diff options
author | Nicolas Noble <pixel@nobis-crew.org> | 2014-08-11 11:53:25 -0700 |
---|---|---|
committer | Nicolas Noble <pixel@nobis-crew.org> | 2014-08-11 11:53:25 -0700 |
commit | 2a2c2e97a9be9fc4db30842ad61e46a1fd7cd125 (patch) | |
tree | 843518e97789df9b85ac2fcc32417e1ec59b1656 /src | |
parent | 3664fe8db6a88e2aed5bc9425dfae92828851a42 (diff) |
Bugs fixing in Lua - we really can't afford to have destructors throwing exceptions, and also making sure we're using the proper types for Handles.
Diffstat (limited to 'src')
-rw-r--r-- | src/BLua.cc | 16 | ||||
-rw-r--r-- | src/LuaHandle.cc | 8 |
2 files changed, 6 insertions, 18 deletions
diff --git a/src/BLua.cc b/src/BLua.cc index f70cf99..55daa3f 100644 --- a/src/BLua.cc +++ b/src/BLua.cc @@ -11,6 +11,7 @@ #include "HelperTasks.h" #include "StacklessTask.h" #include "TaskMan.h" +#include "LuaHandle.h" extern "C" { #include <lualib.h> @@ -98,7 +99,7 @@ int Balau::LuaStatics::dumpvars(lua_State * __L) { if (L.isstring(2)) L.getglobal(L.tostring(2).to_charp()); - IO<Handle> h(L.recast<Balau::Handle>()); + IO<Handle> h(L.recast<LuaIO>()->getIO()); if (!h->canEAgainOnWrite()) { L.dumpvars(h, prefix); @@ -312,19 +313,6 @@ int Balau::LuaStatics::callwrap(lua_State * __L, lua_CFunction func) { return r; } -namespace { - -class CollectorTask : public Balau::StacklessTask { - public: - CollectorTask(Balau::LuaObjectBase * obj) : m_obj(obj) { } - private: - virtual const char * getName() const override { return "CollectorTask"; } - virtual void Do() override { delete m_obj; } - Balau::LuaObjectBase * m_obj; -}; - -}; - int Balau::LuaStatics::collector(lua_State * __L) { Lua L(__L); LuaObjectBase * o = (LuaObjectBase *) L.touserdata(); diff --git a/src/LuaHandle.cc b/src/LuaHandle.cc index 440a4f3..6ee6691 100644 --- a/src/LuaHandle.cc +++ b/src/LuaHandle.cc @@ -2,8 +2,8 @@ #include "LuaBigInt.h" #include "Handle.h" -typedef Balau::IO<Balau::Handle> IOHandle; -typedef IOHandle IOInput; +typedef Balau::LuaIO IOHandle; +typedef Balau::LuaIO IOInput; // Handle exports @@ -102,7 +102,7 @@ struct sLua_IOHandle { int sLua_IOHandle::IOHandle_proceed(Balau::Lua & L, int n, IOHandle * obj, int caller) { int r = 0; - Balau::IO<Balau::Handle> h = *obj; + Balau::IO<Balau::Handle> h = obj->getIO(); switch (caller) { case IOHANDLE_CLOSE: @@ -538,7 +538,7 @@ int sLua_IOInput::IOInput_proceed_static(Balau::Lua & L, int n, int caller) { } int sLua_IOInput::IOInput_proceed(Balau::Lua & L, int n, IOInput * obj, int caller) { - Balau::IO<Balau::Input> h = *obj; + Balau::IO<Balau::Input> h = obj->getIO(); switch (caller) { case IOINPUT_OPEN: |