From be7f6b857547e008500b56a9838b5df72b0b49cd Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 23 Apr 2021 00:22:31 +0300 Subject: SL-14956 Fix landmarks sometimes staying in mLoadedCallbackMap #2 Improved fix --- indra/newview/lllandmarklist.cpp | 29 ++++++++++++++++++++++++++--- indra/newview/lllandmarklist.h | 1 + 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp index b88ef39a07..88d3f2c5b6 100644 --- a/indra/newview/lllandmarklist.cpp +++ b/indra/newview/lllandmarklist.cpp @@ -162,6 +162,16 @@ void LLLandmarkList::processGetAssetReply( gLandmarkList.makeCallbacks(uuid); } } + else + { + // failed to parse, shouldn't happen + gLandmarkList.eraseCallbacks(uuid); + } + } + else + { + // got a good status, but no file, shouldn't happen + gLandmarkList.eraseCallbacks(uuid); } } else @@ -180,7 +190,7 @@ void LLLandmarkList::processGetAssetReply( gLandmarkList.mBadList.insert(uuid); gLandmarkList.mRequestedList.erase(uuid); //mBadList effectively blocks any load, so no point keeping id in requests - // todo: this should clean mLoadedCallbackMap! + gLandmarkList.eraseCallbacks(uuid); } // getAssetData can fire callback immediately, causing @@ -220,19 +230,32 @@ BOOL LLLandmarkList::assetExists(const LLUUID& asset_uuid) void LLLandmarkList::onRegionHandle(const LLUUID& landmark_id) { LLLandmark* landmark = getAsset(landmark_id); + if (!landmark) + { + LL_WARNS() << "Got region handle but the landmark " << landmark_id << " not found." << LL_ENDL; + eraseCallbacks(landmark_id); + return; + } // Calculate landmark global position. // This should succeed since the region handle is available. LLVector3d pos; - if (landmark && !landmark->getGlobalPos(pos)) + if (!landmark->getGlobalPos(pos)) { - LL_WARNS() << "Got region handle but the landmark " << landmark_id << " global position is still unknown." << LL_ENDL; + LL_WARNS() << "Got region handle but the landmark " << landmark_id << " global position is still unknown." << LL_ENDL; + eraseCallbacks(landmark_id); + return; } // Call this even if no landmark exists to clean mLoadedCallbackMap makeCallbacks(landmark_id); } +void LLLandmarkList::eraseCallbacks(const LLUUID& landmark_id) +{ + mLoadedCallbackMap.erase(landmark_id); +} + void LLLandmarkList::makeCallbacks(const LLUUID& landmark_id) { LLLandmark* landmark = getAsset(landmark_id); diff --git a/indra/newview/lllandmarklist.h b/indra/newview/lllandmarklist.h index 2e7bd25610..4f3b11660d 100644 --- a/indra/newview/lllandmarklist.h +++ b/indra/newview/lllandmarklist.h @@ -65,6 +65,7 @@ public: protected: void onRegionHandle(const LLUUID& landmark_id); + void eraseCallbacks(const LLUUID& landmark_id); void makeCallbacks(const LLUUID& landmark_id); typedef std::map landmark_list_t; -- cgit v1.2.3