Re: problem on using shared_ptr
Nigel Atkinson <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <1267521076.1687.8.camel@ninja> |
It's strange that you can not catch the exception. That line (1156) is the end of the method in the object class that does the call to lua, so perhaps if you use your debugger to step line by line from "pu(sender)" onwards. Does it print "update" ? or not get that far? That's what I would do. Then if you have no luck, perhaps try with ordinary raw pointers, and see what changes. In your Lua script, do you have "print" or "prient" like you have in your email? Nigel On Tue, 2010-03-02 at 16:47 +0800, [email protected] wrote: > i have a class which uses shared_ptr: > class Entity:public boost::enable_shared_from_this<Entity> > { > public: > typedef boost::shared_ptr<Entity> Ptr; > ... > ... > } > > and i registed it like this: > > module(context,"sys") > [ > class_<Entity,Entity::Ptr>("Entity") > ... > ... > ]; > > and also i have a little script as: > function ProcessUpdate(sender) > prient("update!"); > end > > now i pass a Entity::Ptr as a parameter to a lua function: > void Server::LuaLogic::ProcessUpdate( Entity::Ptr sender ) > { > _mutContext.lock(); > lua_State *l = _l->Lock(); > int idx=lua_gettop(l); > > try > { > luabind::object pu = luabind::globals(l)["ProcessUpdate"]; > > if(luabind::type(pu)==LUA_TFUNCTION) > { > pu(sender); > } > } > catch (luabind::error* e) > { > const char* what = e->what(); > } > > lua_settop(l,idx); > > _l->Unlock(); > _mutContext.unlock(); > } > > and after(or during) the "pu(sender);",my debuger noticed me a > luabind::error,in object.hpp at line 1156,and i can`t catch it at all > so i don`t understand what happend. > > any help please? > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev