diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-03-21 17:39:33 +0200 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-03-21 21:14:20 +0200 |
commit | 1d79d101ecaa0a4b365e7f28ca022c1e19a43108 (patch) | |
tree | b00d53940c56f844314852a7f32d26a1d61a2da1 | |
parent | da6635702a7d07ddd3a45090cc74aea671c9a7c0 (diff) |
SL-17040 Crash when looking for a region by handle or position
Might be a better idea to turn LLWorld back into an LLSingleton. Too many things to track.
-rw-r--r-- | indra/newview/llavatarrenderinfoaccountant.cpp | 31 | ||||
-rw-r--r-- | indra/newview/llchathistory.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerregion.cpp | 66 | ||||
-rw-r--r-- | indra/newview/llviewerstats.cpp | 8 |
4 files changed, 94 insertions, 13 deletions
diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index ca83afb5ab..140b9e6f36 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -82,7 +82,15 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(std::string url, U64 LLSD result = httpAdapter->getAndSuspend(httpRequest, url); - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); + LLWorld *world_inst = LLWorld::getInstance(); + if (!world_inst) + { + LL_WARNS("AvatarRenderInfoAccountant") << "Avatar render weight info received but world no longer exists " + << regionHandle << LL_ENDL; + return; + } + + LLViewerRegion * regionp = world_inst->getRegionFromHandle(regionHandle); if (!regionp) { LL_WARNS("AvatarRenderInfoAccountant") << "Avatar render weight info received but region not found for " @@ -183,7 +191,15 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("AvatarRenderInfoAccountant", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); + LLWorld *world_inst = LLWorld::getInstance(); + if (!world_inst) + { + LL_WARNS("AvatarRenderInfoAccountant") << "Avatar render weight calculation but world no longer exists " + << regionHandle << LL_ENDL; + return; + } + + LLViewerRegion * regionp = world_inst->getRegionFromHandle(regionHandle); if (!regionp) { LL_WARNS("AvatarRenderInfoAccountant") << "Avatar render weight calculation but region not found for " @@ -239,9 +255,18 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U report[KEY_AGENTS] = agents; regionp = NULL; + world_inst = NULL; LLSD result = httpAdapter->postAndSuspend(httpRequest, url, report); - regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); + world_inst = LLWorld::getInstance(); + if (!world_inst) + { + LL_WARNS("AvatarRenderInfoAccountant") << "Avatar render weight POST result but world no longer exists " + << regionHandle << LL_ENDL; + return; + } + + regionp = world_inst->getRegionFromHandle(regionHandle); if (!regionp) { LL_INFOS("AvatarRenderInfoAccountant") << "Avatar render weight POST result received but region not found for " diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index c110e0d815..cdf82c77c1 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -752,7 +752,7 @@ public: if ( chat.mSourceType == CHAT_SOURCE_OBJECT) { std::string slurl = args["slurl"].asString(); - if (slurl.empty()) + if (slurl.empty() && LLWorld::instanceExists()) { LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); if(region) diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 27fbf39673..501148a112 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -266,7 +266,14 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) return; } - regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); + LLWorld *world_inst = LLWorld::getInstance(); // Not a singleton! + if (!world_inst) + { + LL_WARNS("AppInit", "Capabilities") << "Attempting to get capabilities, but world no longer exists!" << LL_ENDL; + return; + } + + regionp = world_inst->getRegionFromHandle(regionHandle); if (!regionp) //region was removed { LL_WARNS("AppInit", "Capabilities") << "Attempting to get capabilities for region that no longer exists!" << LL_ENDL; @@ -314,6 +321,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) regionp = NULL; impl = NULL; + world_inst = NULL; result = httpAdapter->postAndSuspend(httpRequest, url, capabilityNames); if (STATE_WORLD_INIT > LLStartUp::getStartupState()) @@ -327,7 +335,14 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) return; } - regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); + world_inst = LLWorld::getInstance(); + if (!world_inst) + { + LL_WARNS("AppInit", "Capabilities") << "Received capabilities, but world no longer exists!" << LL_ENDL; + return; + } + + regionp = world_inst->getRegionFromHandle(regionHandle); if (!regionp) //region was removed { LL_WARNS("AppInit", "Capabilities") << "Received capabilities for region that no longer exists!" << LL_ENDL; @@ -411,7 +426,14 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle) // This loop is used for retrying a capabilities request. do { - regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); + LLWorld *world_inst = LLWorld::getInstance(); // Not a singleton! + if (!world_inst) + { + LL_WARNS("AppInit", "Capabilities") << "Attempting to get capabilities, but world no longer exists!" << LL_ENDL; + return; + } + + regionp = world_inst->getRegionFromHandle(regionHandle); if (!regionp) //region was removed { LL_WARNS("AppInit", "Capabilities") << "Attempting to get capabilities for region that no longer exists!" << LL_ENDL; @@ -434,6 +456,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle) LL_INFOS("AppInit", "Capabilities") << "Requesting second Seed from " << url << " for region " << regionp->getRegionID() << LL_ENDL; regionp = NULL; + world_inst = NULL; result = httpAdapter->postAndSuspend(httpRequest, url, capabilityNames); LLSD httpResults = result["http_result"]; @@ -449,7 +472,14 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle) break; } - regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); + world_inst = LLWorld::getInstance(); + if (!world_inst) + { + LL_WARNS("AppInit", "Capabilities") << "Received capabilities, but world no longer exists!" << LL_ENDL; + return; + } + + regionp = world_inst->getRegionFromHandle(regionHandle); if (!regionp) //region was removed { LL_WARNS("AppInit", "Capabilities") << "Received capabilities for region that no longer exists!" << LL_ENDL; @@ -533,7 +563,14 @@ void LLViewerRegionImpl::requestSimulatorFeatureCoro(std::string url, U64 region break; } - regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); + LLWorld *world_inst = LLWorld::getInstance(); // Not a singleton! + if (!world_inst) + { + LL_WARNS("AppInit", "Capabilities") << "Attempting to request Sim Feature, but world no longer exists!" << LL_ENDL; + return; + } + + regionp = world_inst->getRegionFromHandle(regionHandle); if (!regionp) //region was removed { LL_WARNS("AppInit", "SimulatorFeatures") << "Attempting to request Sim Feature for region that no longer exists!" << LL_ENDL; @@ -541,6 +578,7 @@ void LLViewerRegionImpl::requestSimulatorFeatureCoro(std::string url, U64 region } regionp = NULL; + world_inst = NULL; LLSD result = httpAdapter->getAndSuspend(httpRequest, url); LLSD httpResults = result["http_result"]; @@ -559,7 +597,14 @@ void LLViewerRegionImpl::requestSimulatorFeatureCoro(std::string url, U64 region // remove the http_result from the llsd result.erase("http_result"); - regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); + world_inst = LLWorld::getInstance(); + if (!world_inst) + { + LL_WARNS("AppInit", "Capabilities") << "Attempting to request Sim Feature, but world no longer exists!" << LL_ENDL; + return; + } + + regionp = world_inst->getRegionFromHandle(regionHandle); if (!regionp) //region was removed { LL_WARNS("AppInit", "SimulatorFeatures") << "Attempting to set Sim Feature for region that no longer exists!" << LL_ENDL; @@ -2092,7 +2137,14 @@ public: const LLSD& input) const { LLHost host(input["sender"].asString()); - LLViewerRegion* region = LLWorld::getInstance()->getRegion(host); + + LLWorld *world_inst = LLWorld::getInstance(); // Not a singleton! + if (!world_inst) + { + return; + } + + LLViewerRegion* region = world_inst->getRegion(host); if( !region ) { return; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 57a3d011d5..9d6cfbce7c 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -392,8 +392,12 @@ void update_statistics() gTransferManager.resetTransferBitsIn(LLTCT_ASSET); sample(LLStatViewer::VISIBLE_AVATARS, LLVOAvatar::sNumVisibleAvatars); - LLWorld::getInstance()->updateNetStats(); - LLWorld::getInstance()->requestCacheMisses(); + LLWorld *world = LLWorld::getInstance(); // not LLSingleton + if (world) + { + world->updateNetStats(); + world->requestCacheMisses(); + } // Reset all of these values. gVLManager.resetBitCounts(); |