From: John L. <jr...@us...> - 2006-06-21 03:58:06
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv30674/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: fix garbage collection function wxLua_lua_garbageCollect to use tracked and derived hash maps add wxLIGHT_GREY Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** wxlstate.cpp 6 Jun 2006 05:14:32 -0000 1.72 --- wxlstate.cpp 21 Jun 2006 03:58:03 -0000 1.73 *************** *** 1548,1551 **** --- 1548,1552 ---- wxLongToLongHashMap::iterator it = M_WXLSTATEDATA->m_wxlStateData->m_pTrackedList.find((long) pObject); + if (it != M_WXLSTATEDATA->m_wxlStateData->m_pTrackedList.end()) { Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** wxlbind.cpp 6 Jun 2006 05:14:32 -0000 1.36 --- wxlbind.cpp 21 Jun 2006 03:58:03 -0000 1.37 *************** *** 65,74 **** --- 65,84 ---- WXLUACLASS *pClass = (WXLUACLASS *)lua_touserdata(L, lua_upvalueindex(1)); + //bool tracked = false; + if ((pClass != NULL) && lua_isuserdata(L, 1) && (lua_islightuserdata(L, 1) == 0) && (wxlState.ttag(1) == *pClass->class_tag)) { long key = (long)wxlState.ttouserdata(1, true); + + wxCHECK_MSG(key != 0, 0, wxT("NULL user data in wxLua_lua_garbageCollect")); + + //tracked = + wxlState.RemoveTrackedMemory((void*)key, true); // delete from m_pTrackedList + wxLongToLongHashMap::iterator it = wxlState.GetLuaStateData()->m_pDerivedList.find(key); if (it != wxlState.GetLuaStateData()->m_pDerivedList.end()) { + //wxPrintf(wxT("wxLua_lua_garbageCollect - Derived GC '%s'\n"), lua2wx(pClass->name).c_str()); + wxLuaStringToLongHashMap *pHashTable = (wxLuaStringToLongHashMap *)it->second; if (pHashTable != NULL) *************** *** 79,82 **** --- 89,93 ---- wxlState.GetLuaStateData()->m_pDerivedList.erase(it); } + //else wxPrintf(wxT("wxLua_lua_garbageCollect - Invalid WXLUACLASS derived hashmap iterator key %d!\n"), key); int iMethod; *************** *** 91,94 **** --- 102,110 ---- } } + //else wxPrintf(wxT("wxLua_lua_garbageCollect - NULL WXLUACLASS!\n")); + + //wxPrintf(wxT("wxLua_lua_garbageCollect - '%s' tag %d lua %d tracked %d return value %d\n"), + // lua2wx(pClass ? pClass->name : "").c_str(), pClass ? *pClass->class_tag : 0, (int)L, (int)tracked, retVal); + return retVal; } *************** *** 191,195 **** const char *cpIndex = lua_tostring(L, 2); ! wxPrintf(wxT("wxLua_lua_setTableFunc '%s'\n"), lua2wx(cpIndex).c_str()); if ((pClass != NULL) && lua_isuserdata(L, 1) && --- 207,211 ---- const char *cpIndex = lua_tostring(L, 2); ! //wxPrintf(wxT("wxLua_lua_setTableFunc '%s'\n"), lua2wx(cpIndex).c_str()); if ((pClass != NULL) && lua_isuserdata(L, 1) && |