From: John L. <jr...@us...> - 2007-06-28 22:46:00
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6193/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: Add a lua reg table to track ALL items pushed into lua, for debugging Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** wxlstate.cpp 25 Jun 2007 23:04:02 -0000 1.118 --- wxlstate.cpp 28 Jun 2007 22:45:57 -0000 1.119 *************** *** 44,47 **** --- 44,48 ---- int wxlua_lreg_derivedmethods_key = WXLUA_LREG_DERIVED_METHODS; int wxlua_lreg_wxluastaterefdata_key = WXLUA_LREG_WXLUASTATEREFDATA; + int wxlua_lreg_objects_key = WXLUA_LREG_OBJECTS; int wxlua_lreg_callbaseclassfunc_key = WXLUA_LREG_CALLBASECLASSFUNC; *************** *** 351,358 **** { // pop the table and set it as the metatable for the newuserdata ! if (lua_setmetatable(L, -2) == 0) ! wxlua_terror(L, "wxLua: Unable to set metatable in tpushusertag."); ! else return true; } } --- 352,369 ---- { // pop the table and set it as the metatable for the newuserdata ! if (lua_setmetatable(L, -2) != 0) ! { ! wxlua_pushkey_wxLuaObjects(L); ! lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the obj table) ! ! lua_pushlightuserdata(L, (void*)u); ! lua_pushnumber(L, tag); // t["lightuserdata ptr"] = tag ! lua_rawset(L, -3); ! lua_pop(L, 1); ! return true; + } + else + wxlua_terror(L, "wxLua: Unable to set metatable in tpushusertag."); } } *************** *** 1929,1932 **** --- 1940,1948 ---- lua_rawset( L, LUA_REGISTRYINDEX ); // set the value + // Create a table for all userdata that we've pushed into lua + wxlua_pushkey_wxLuaObjects(L); + lua_newtable(L); + lua_rawset( L, LUA_REGISTRYINDEX ); // set the value + // Register bindings wxLuaBindingList::compatibility_iterator node = M_WXLSTATEDATA->m_wxlStateData->m_bindingList.GetFirst(); Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** wxlbind.cpp 28 Jun 2007 21:52:56 -0000 1.82 --- wxlbind.cpp 28 Jun 2007 22:45:57 -0000 1.83 *************** *** 253,256 **** --- 253,263 ---- wxCHECK_MSG(key != 0, 0, wxT("NULL user data in wxluabind_gc_wxLuaBindClass")); + wxlua_pushkey_wxLuaObjects(L); + lua_rawget(L, LUA_REGISTRYINDEX); // pop key, push result (the classes table) + lua_pushlightuserdata(L, (void*)key); + lua_pushnil(L); // t["lightuserdata ptr"] = nil to remove it + lua_rawset(L, -3); + lua_pop(L, 1); + wxlState.RemoveTrackedObject(key, true); wxlua_removederivedmethod(L, key); |