Skip to content

Commit

Permalink
SL-15628 Crash inside ~LLModelInstanceBase
Browse files Browse the repository at this point in the history
More explicit cleanup in hopes of narrowing down which of the models
failed
  • Loading branch information
akleshchev committed Dec 15, 2023
1 parent 009cd9a commit 8ea1f4a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion indra/llmath/llvolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ class LLVolume : public LLRefCount
friend class LLVolumeLODGroup;

protected:
~LLVolume(); // use unref
virtual ~LLVolume(); // use unref

public:
typedef std::vector<LLVolumeFace> face_list_t;
Expand Down
1 change: 1 addition & 0 deletions indra/llprimitive/llmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ LLModel::~LLModel()
{
LLConvexDecomposition::getInstance()->deleteDecomposition(mDecompID);
}
mPhysics.mMesh.clear();
}

//static
Expand Down
16 changes: 15 additions & 1 deletion indra/llprimitive/llmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ class LLModel : public LLVolume
std::vector<LLVector3> mPositions;
std::vector<LLVector3> mNormals;

~PhysicsMesh() {}

void clear()
{
mPositions.clear();
Expand All @@ -131,6 +133,7 @@ class LLModel : public LLVolume
public:
Decomposition() { }
Decomposition(LLSD& data);
~Decomposition() { }
void fromLLSD(LLSD& data);
LLSD asLLSD() const;
bool hasHullList() const;
Expand Down Expand Up @@ -365,7 +368,7 @@ class LLModelInstanceBase
{
public:
LLPointer<LLModel> mModel;
LLPointer<LLModel> mLOD[5];
LLPointer<LLModel> mLOD[LLModel::NUM_LODS];
LLUUID mMeshID;

LLMatrix4 mTransform;
Expand All @@ -380,6 +383,15 @@ class LLModelInstanceBase
: mModel(NULL)
{
}

virtual ~LLModelInstanceBase()
{
mModel = NULL;
for (int j = 0; j < LLModel::NUM_LODS; ++j)
{
mLOD[j] = NULL;
}
};
};

typedef std::vector<LLModelInstanceBase> model_instance_list;
Expand All @@ -399,6 +411,8 @@ class LLModelInstance : public LLModelInstanceBase

LLModelInstance(LLSD& data);

~LLModelInstance() {}

LLSD asLLSD();
};

Expand Down
10 changes: 10 additions & 0 deletions indra/newview/llmodelpreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ LLModelPreview::~LLModelPreview()
mPreviewAvatar->markDead();
mPreviewAvatar = NULL;
}

mUploadData.clear();
mTextureSet.clear();

for (U32 i = 0; i < LLModel::NUM_LODS; i++)
{
clearModel(i);
}
mBaseModel.clear();
mBaseScene.clear();
}

void LLModelPreview::updateDimentionsAndOffsets()
Expand Down
1 change: 0 additions & 1 deletion indra/newview/llmodelpreview.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex
vv_LLVolumeFace_t mBaseModelFacesCopy;

U32 mGroup;
std::map<LLPointer<LLModel>, U32> mObject;

// Amount of triangles in original(base) model
U32 mMaxTriangleLimit;
Expand Down

0 comments on commit 8ea1f4a

Please sign in to comment.