From c65bbadb2f6bc6828c149e3c468473a8c12d094c Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Sun, 21 Jul 2024 20:10:02 -0400 Subject: Fix rare shutdown crash in LLViewerObjectList --- indra/newview/llviewermessage.cpp | 2 +- indra/newview/llviewerobject.cpp | 10 +++++----- indra/newview/llviewerobjectlist.cpp | 24 +++++++++++------------- indra/newview/llviewerobjectlist.h | 14 +++++++------- 4 files changed, 24 insertions(+), 26 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 5a32f9654d..0d5482dcd1 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3602,7 +3602,7 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data) U32 local_id; mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i); - LLViewerObjectList::getUUIDFromLocal(id, local_id, ip, port); + gObjectList.getUUIDFromLocal(id, local_id, ip, port); if (id == LLUUID::null) { LL_DEBUGS("Messaging") << "Unknown kill for local " << local_id << LL_ENDL; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e108f9c268..9ad2474e9b 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1940,14 +1940,14 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if(mesgsys != NULL) { - LLViewerObjectList::getUUIDFromLocal(parent_uuid, + gObjectList.getUUIDFromLocal(parent_uuid, parent_id, mesgsys->getSenderIP(), mesgsys->getSenderPort()); } else { - LLViewerObjectList::getUUIDFromLocal(parent_uuid, + gObjectList.getUUIDFromLocal(parent_uuid, parent_id, mRegionp->getHost().getAddress(), mRegionp->getHost().getPort()); @@ -2062,7 +2062,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Debugging for suspected problems with local ids. //LLUUID parent_uuid; - //LLViewerObjectList::getUUIDFromLocal(parent_uuid, parent_id, mesgsys->getSenderIP(), mesgsys->getSenderPort() ); + //gObjectList.getUUIDFromLocal(parent_uuid, parent_id, mesgsys->getSenderIP(), mesgsys->getSenderPort() ); //if (parent_uuid != cur_parentp->getID() ) //{ // LL_ERRS() << "Local ID match but UUID mismatch of viewer object" << LL_ENDL; @@ -2085,14 +2085,14 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if(mesgsys != NULL) { - LLViewerObjectList::getUUIDFromLocal(parent_uuid, + gObjectList.getUUIDFromLocal(parent_uuid, parent_id, gMessageSystem->getSenderIP(), gMessageSystem->getSenderPort()); } else { - LLViewerObjectList::getUUIDFromLocal(parent_uuid, + gObjectList.getUUIDFromLocal(parent_uuid, parent_id, mRegionp->getHost().getAddress(), mRegionp->getHost().getPort()); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 08a1ba0f9b..bfbb701a8e 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -99,8 +99,6 @@ extern LLPipeline gPipeline; // Statics for object lookup tables. U32 LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check. -std::map LLViewerObjectList::sIPAndPortToIndex; -std::map LLViewerObjectList::sIndexAndLocalIDToUUID; LLViewerObjectList::LLViewerObjectList() { @@ -138,17 +136,17 @@ void LLViewerObjectList::getUUIDFromLocal(LLUUID &id, { U64 ipport = (((U64)ip) << 32) | (U64)port; - U32 index = sIPAndPortToIndex[ipport]; + U32 index = mIPAndPortToIndex[ipport]; if (!index) { index = sSimulatorMachineIndex++; - sIPAndPortToIndex[ipport] = index; + mIPAndPortToIndex[ipport] = index; } U64 indexid = (((U64)index) << 32) | (U64)local_id; - id = get_if_there(sIndexAndLocalIDToUUID, indexid, LLUUID::null); + id = get_if_there(mIndexAndLocalIDToUUID, indexid, LLUUID::null); } U64 LLViewerObjectList::getIndex(const U32 local_id, @@ -157,7 +155,7 @@ U64 LLViewerObjectList::getIndex(const U32 local_id, { U64 ipport = (((U64)ip) << 32) | (U64)port; - U32 index = sIPAndPortToIndex[ipport]; + U32 index = mIPAndPortToIndex[ipport]; if (!index) { @@ -177,14 +175,14 @@ bool LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp) U32 ip = objectp->getRegion()->getHost().getAddress(); U32 port = objectp->getRegion()->getHost().getPort(); U64 ipport = (((U64)ip) << 32) | (U64)port; - U32 index = sIPAndPortToIndex[ipport]; + U32 index = mIPAndPortToIndex[ipport]; // LL_INFOS() << "Removing object from table, local ID " << local_id << ", ip " << ip << ":" << port << LL_ENDL; U64 indexid = (((U64)index) << 32) | (U64)local_id; - std::map::iterator iter = sIndexAndLocalIDToUUID.find(indexid); - if (iter == sIndexAndLocalIDToUUID.end()) + std::map::iterator iter = mIndexAndLocalIDToUUID.find(indexid); + if (iter == mIndexAndLocalIDToUUID.end()) { return false; } @@ -192,7 +190,7 @@ bool LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp) // Found existing entry if (iter->second == objectp->getID()) { // Full UUIDs match, so remove the entry - sIndexAndLocalIDToUUID.erase(iter); + mIndexAndLocalIDToUUID.erase(iter); return true; } // UUIDs did not match - this would zap a valid entry, so don't erase it @@ -210,17 +208,17 @@ void LLViewerObjectList::setUUIDAndLocal(const LLUUID &id, { U64 ipport = (((U64)ip) << 32) | (U64)port; - U32 index = sIPAndPortToIndex[ipport]; + U32 index = mIPAndPortToIndex[ipport]; if (!index) { index = sSimulatorMachineIndex++; - sIPAndPortToIndex[ipport] = index; + mIPAndPortToIndex[ipport] = index; } U64 indexid = (((U64)index) << 32) | (U64)local_id; - sIndexAndLocalIDToUUID[indexid] = id; + mIndexAndLocalIDToUUID[indexid] = id; //LL_INFOS() << "Adding object to table, full ID " << id // << ", local ID " << local_id << ", ip " << ip << ":" << port << LL_ENDL; diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index f0f236d6ae..ebdfd0d369 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -171,18 +171,18 @@ public: // used to discount stats from this frame bool mWasPaused; - static void getUUIDFromLocal(LLUUID &id, + void getUUIDFromLocal(LLUUID &id, const U32 local_id, const U32 ip, const U32 port); - static void setUUIDAndLocal(const LLUUID &id, + void setUUIDAndLocal(const LLUUID &id, const U32 local_id, const U32 ip, const U32 port); // Requires knowledge of message system info! - static bool removeFromLocalIDTable(const LLViewerObject* objectp); + bool removeFromLocalIDTable(const LLViewerObject* objectp); // Used ONLY by the orphaned object code. - static U64 getIndex(const U32 local_id, const U32 ip, const U32 port); + U64 getIndex(const U32 local_id, const U32 ip, const U32 port); S32 mNumUnknownUpdates; S32 mNumDeadObjectUpdates; @@ -216,9 +216,9 @@ protected: S32 mCurLazyUpdateIndex; static U32 sSimulatorMachineIndex; - static std::map sIPAndPortToIndex; + std::map mIPAndPortToIndex; - static std::map sIndexAndLocalIDToUUID; + std::map mIndexAndLocalIDToUUID; friend class LLViewerObject; @@ -257,7 +257,7 @@ extern LLViewerObjectList gObjectList; */ inline LLViewerObject *LLViewerObjectList::findObject(const LLUUID &id) { - std::map >::iterator iter = mUUIDObjectMap.find(id); + auto iter = mUUIDObjectMap.find(id); if(iter != mUUIDObjectMap.end()) { return iter->second; -- cgit v1.2.3