From: John L. <jr...@us...> - 2007-03-15 00:01:40
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15657/wxLua/modules/wxlua/src Modified Files: wxlbind.cpp wxlstate.cpp Log Message: Remove wxLua_AddTrackedObject functions and just use wxLuaState::AddTrackedObject directly Remove all gc (destructor, LuaDelete) functions from the methods of a class since we can delete the objects in the single gc function in wxlbind.cpp anyway. Index: wxlstate.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** wxlstate.cpp 26 Feb 2007 01:57:06 -0000 1.88 --- wxlstate.cpp 15 Mar 2007 00:01:25 -0000 1.89 *************** *** 1919,1922 **** --- 1919,1924 ---- wxLongToLongHashMap::iterator it = M_WXLSTATEDATA->m_wxlStateData->m_trackedObjects.find((long) pObject); + //wxPrintf(wxT("RemoveTracked %ld %d\n"), long(pObject), int(fDelete)); + if (it != M_WXLSTATEDATA->m_wxlStateData->m_trackedObjects.end()) { *************** *** 1931,1934 **** --- 1933,1938 ---- M_WXLSTATEDATA->m_wxlStateData->m_trackedObjects.erase(it); + //wxPrintf(wxT("RemoveTRACKED %ld %d\n"), long(pObject), int(fDelete)); + return true; } Index: wxlbind.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlbind.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** wxlbind.cpp 26 Feb 2007 05:17:29 -0000 1.52 --- wxlbind.cpp 15 Mar 2007 00:01:25 -0000 1.53 *************** *** 229,241 **** // ---------------------------------------------------------------------------- - // wxLua_AddToTrackedMemoryList - // ---------------------------------------------------------------------------- - - void LUACALL wxLua_AddTrackedObject(wxLuaState& wxlState, wxObject *pObject) - { - wxlState.AddTrackedObject(pObject); - } - - // ---------------------------------------------------------------------------- // wxLua_lua_tableErrorHandler // ---------------------------------------------------------------------------- --- 229,232 ---- *************** *** 260,268 **** //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")); --- 251,260 ---- //bool tracked = false; + long key = -1; if ((pClass != NULL) && lua_isuserdata(L, 1) && (lua_islightuserdata(L, 1) == 0) && (wxlState.ttag(1) == *pClass->class_tag)) { ! key = (long)wxlState.ttouserdata(1, true); wxCHECK_MSG(key != 0, 0, wxT("NULL user data in wxLua_lua_garbageCollect")); *************** *** 284,305 **** } //else wxPrintf(wxT("wxLua_lua_garbageCollect - Invalid WXLUACLASS derived hashmap iterator key %d!\n"), key); - - // LuaDelete is placed at the end, so start there first and if found - // call the function - int i_method, method_count = pClass->num_methods; - for (i_method = method_count-1; i_method >= 0; --i_method) - { - WXLUAMETHOD *pMethod = pClass->methods + i_method; - if (pMethod->type == LuaDelete) - { - retVal = (*pMethod->func)(L); - break; - } - } } //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; --- 276,284 ---- } //else wxPrintf(wxT("wxLua_lua_garbageCollect - Invalid WXLUACLASS derived hashmap iterator key %d!\n"), key); } //else wxPrintf(wxT("wxLua_lua_garbageCollect - NULL WXLUACLASS!\n")); ! //wxPrintf(wxT("wxLua_lua_garbageCollect - '%s' tag %d lua %d key %ld tracked %d return value %d\n"), ! // lua2wx(pClass ? pClass->name : "").c_str(), pClass ? *pClass->class_tag : 0, (int)L, key, (int)tracked, retVal); return retVal; |