From 7b44a8ee8de662355c8f5c8091ab25dccce494e5 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 22 Sep 2010 15:58:35 -0500 Subject: SH-110 Fix for viewer crash when checking HULL in decomposition window... converted various maps to use smart pointers for keys instead of naked pointers, properly clear maps on various operations. --- indra/newview/llfloatermodelpreview.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 088c9e6546..8be56009aa 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1989,13 +1989,13 @@ void LLModelPreview::loadModel(std::string filename, S32 lod) if (lod == 3 && !mGroup.empty()) { - for (std::map::iterator iter = mGroup.begin(); iter != mGroup.end(); ++iter) + for (std::map, U32>::iterator iter = mGroup.begin(); iter != mGroup.end(); ++iter) { glodDeleteGroup(iter->second); stop_gloderror(); } - for (std::map::iterator iter = mObject.begin(); iter != mObject.end(); ++iter) + for (std::map, U32>::iterator iter = mObject.begin(); iter != mObject.end(); ++iter) { glodDeleteObject(iter->second); stop_gloderror(); @@ -2055,6 +2055,11 @@ void LLModelPreview::loadModelCallback(S32 lod) mScene[lod] = mModelLoader->mScene; mVertexBuffer[lod].clear(); + if (lod == LLModel::LOD_PHYSICS) + { + mPhysicsMesh.clear(); + } + setPreviewLOD(lod); @@ -2338,6 +2343,11 @@ void LLModelPreview::genLODs(S32 which_lod) return; } + if (which_lod == LLModel::LOD_PHYSICS) + { //clear physics mesh map + mPhysicsMesh.clear(); + } + LLVertexBuffer::unbind(); stop_gloderror(); @@ -2365,6 +2375,14 @@ void LLModelPreview::genLODs(S32 which_lod) U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0; + if (mGroup[mBaseModel[0]] == 0) + { //clear LOD maps + mGroup.clear(); + mObject.clear(); + mPercentage.clear(); + mPatch.clear(); + } + for (LLModelLoader::model_list::iterator iter = mBaseModel.begin(); iter != mBaseModel.end(); ++iter) { //build GLOD objects for each model in base model list LLModel* mdl = *iter; @@ -3118,7 +3136,7 @@ BOOL LLModelPreview::render() { LLMutexLock(decomp->mMutex); - std::map > >::iterator iter = + std::map, std::vector > >::iterator iter = mPhysicsMesh.find(model); if (iter != mPhysicsMesh.end()) { @@ -3406,7 +3424,7 @@ void LLFloaterModelPreview::onDecompose(void* user_data) void LLFloaterModelPreview::onModelDecompositionComplete(LLModel* model, std::vector >& physics_mesh) { if (sInstance && sInstance->mModelPreview) - { + { sInstance->mModelPreview->mPhysicsMesh[model] = physics_mesh; sInstance->mModelPreview->mDirty = true; -- cgit v1.2.3