diff options
author | Seth ProductEngine <slitovchuk@productengine.com> | 2012-04-26 00:40:42 +0300 |
---|---|---|
committer | Seth ProductEngine <slitovchuk@productengine.com> | 2012-04-26 00:40:42 +0300 |
commit | 784ec584013eff80ab31d10370c14e2d954cea51 (patch) | |
tree | eef2372f86d80de19f940b2f4ac5ca1de38e661c /indra | |
parent | 9b87cfbc9182d7ae059734e1d70c089dc1d304b8 (diff) |
MAINT-813 FIXED crash when trying to access the region info after viewer disconnect.
Added checks for LLViewerRegion pointer in LLViewerObject being invalid.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llviewerobject.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llworld.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llworld.h | 5 |
3 files changed, 38 insertions, 15 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e590f29a9a..cd300accb7 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -877,6 +877,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, LLMemType mt(LLMemType::MTYPE_OBJECT); U32 retval = 0x0; + // If region is removed from the list it is also deleted. + if (!LLWorld::instance().isRegionListed(mRegionp)) + { + llwarns << "Updating object in an invalid region" << llendl; + return retval; + } + // Coordinates of objects on simulators are region-local. U64 region_handle; mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); @@ -3478,7 +3485,8 @@ LLNameValue *LLViewerObject::getNVPair(const std::string& name) const void LLViewerObject::updatePositionCaches() const { - if(mRegionp) + // If region is removed from the list it is also deleted. + if(mRegionp && LLWorld::instance().isRegionListed(mRegionp)) { if (!isRoot()) { @@ -3495,7 +3503,8 @@ void LLViewerObject::updatePositionCaches() const const LLVector3d LLViewerObject::getPositionGlobal() const { - if(mRegionp) + // If region is removed from the list it is also deleted. + if(mRegionp && LLWorld::instance().isRegionListed(mRegionp)) { LLVector3d position_global = mRegionp->getPosGlobalFromRegion(getPositionRegion()); @@ -3514,7 +3523,8 @@ const LLVector3d LLViewerObject::getPositionGlobal() const const LLVector3 &LLViewerObject::getPositionAgent() const { - if (mRegionp) + // If region is removed from the list it is also deleted. + if(mRegionp && LLWorld::instance().isRegionListed(mRegionp)) { if (mDrawable.notNull() && (!mDrawable->isRoot() && getParent())) { diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index fbd8b3ada3..3d971e738e 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1188,20 +1188,23 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter; - LLVector3d pos_global = pVOAvatar->getPositionGlobal(); - LLUUID uuid = pVOAvatar->getID(); - if( !pVOAvatar->isDead() - && !pVOAvatar->isSelf() - && !uuid.isNull() && - dist_vec_squared(pos_global, relative_to) <= radius_squared) + + if (!pVOAvatar->isDead() && !pVOAvatar->isSelf()) { - if(positions != NULL) - { - positions->push_back(pos_global); - } - if(avatar_ids !=NULL) + LLVector3d pos_global = pVOAvatar->getPositionGlobal(); + LLUUID uuid = pVOAvatar->getID(); + + if (!uuid.isNull() + && dist_vec_squared(pos_global, relative_to) <= radius_squared) { - avatar_ids->push_back(uuid); + if(positions != NULL) + { + positions->push_back(pos_global); + } + if(avatar_ids !=NULL) + { + avatar_ids->push_back(uuid); + } } } } @@ -1232,6 +1235,11 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi } } +bool LLWorld::isRegionListed(const LLViewerRegion* region) const +{ + region_list_t::const_iterator it = find(mRegionList.begin(), mRegionList.end(), region); + return it != mRegionList.end(); +} LLHTTPRegistration<LLEstablishAgentCommunication> gHTTPRegistrationEstablishAgentCommunication( diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index d8ab4bc508..f350009d10 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -157,6 +157,11 @@ public: std::vector<LLVector3d>* positions = NULL, const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const; + // Returns 'true' if the region is in mRegionList, + // 'false' if the region has been removed due to region change + // or if the circuit to this simulator had been lost. + bool isRegionListed(const LLViewerRegion* region) const; + private: region_list_t mActiveRegionList; region_list_t mRegionList; |