From c1bc32ad42413342dfff396c7b37372619a03f72 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Mon, 12 Aug 2024 14:40:40 +0200 Subject: #2253 BugSplat Crash #1504389: SecondLifeViewer!LLVOAvatar::updateRiggingInfo(10561) --- indra/newview/llvoavatar.cpp | 57 ++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f813df3fb5..09375a6930 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -10634,18 +10634,19 @@ void showRigInfoTabExtents(LLVOAvatar *avatar, LLJointRiggingInfoTab& tab, S32& void LLVOAvatar::getAssociatedVolumes(std::vector& volumes) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - for ( LLVOAvatar::attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter ) + for (const auto& iter : mAttachmentPoints) { - LLViewerJointAttachment* attachment = iter->second; + LLViewerJointAttachment* attachment = iter.second; LLViewerJointAttachment::attachedobjs_vec_t::iterator attach_end = attachment->mAttachedObjects.end(); - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attach_iter = attachment->mAttachedObjects.begin(); - attach_iter != attach_end; ++attach_iter) + for (LLViewerObject* attached_object : attachment->mAttachedObjects) { - LLViewerObject* attached_object = attach_iter->get(); - LLVOVolume *volume = dynamic_cast(attached_object); - if (volume) + if (attached_object->isDead()) + continue; + + if (attached_object->getPCode() == LL_PCODE_VOLUME) { + LLVOVolume* volume = (LLVOVolume*)attached_object; volumes.push_back(volume); if (volume->isAnimatedObject()) { @@ -10655,15 +10656,12 @@ void LLVOAvatar::getAssociatedVolumes(std::vector& volumes) continue; } } - LLViewerObject::const_child_list_t& children = attached_object->getChildren(); - for (LLViewerObject::const_child_list_t::const_iterator it = children.begin(); - it != children.end(); ++it) + + for (LLViewerObject* childp : attached_object->getChildren()) { - LLViewerObject *childp = *it; - LLVOVolume *volume = dynamic_cast(childp); - if (volume) + if (!childp->isDead() && childp->getPCode() == LL_PCODE_VOLUME) { - volumes.push_back(volume); + volumes.push_back((LLVOVolume*)childp); } } } @@ -10702,33 +10700,30 @@ void LLVOAvatar::updateRiggingInfo() getAssociatedVolumes(volumes); - std::map curr_rigging_info_key; + std::map curr_rigging_info_key; + + // Get current rigging info key + for (LLVOVolume* vol : volumes) { - // Get current rigging info key - for (std::vector::iterator it = volumes.begin(); it != volumes.end(); ++it) + if (vol->isMesh() && vol->getVolume()) { - LLVOVolume *vol = *it; - if (vol->isMesh() && vol->getVolume()) - { - const LLUUID& mesh_id = vol->getVolume()->getParams().getSculptID(); - S32 max_lod = llmax(vol->getLOD(), vol->mLastRiggingInfoLOD); - curr_rigging_info_key[mesh_id] = max_lod; - } + const LLUUID& mesh_id = vol->getVolume()->getParams().getSculptID(); + S32 max_lod = llmax(vol->getLOD(), vol->mLastRiggingInfoLOD); + curr_rigging_info_key[mesh_id] = max_lod; } + } - // Check for key change, which indicates some change in volume composition or LOD. - if (curr_rigging_info_key == mLastRiggingInfoKey) - { - return; - } + // Check for key change, which indicates some change in volume composition or LOD. + if (curr_rigging_info_key == mLastRiggingInfoKey) + { + return; } // Something changed. Update. mLastRiggingInfoKey = curr_rigging_info_key; mJointRiggingInfoTab.clear(); - for (std::vector::iterator it = volumes.begin(); it != volumes.end(); ++it) + for (LLVOVolume* vol : volumes) { - LLVOVolume *vol = *it; vol->updateRiggingInfo(); mJointRiggingInfoTab.merge(vol->mJointRiggingInfoTab); } -- cgit v1.2.3