fix for hasaccumulation exception

There is an exception on teardown usually during a debug build that is caused during shapeBase onRemove calling hasAccumulation.

This fix reorders the hasAccumulation check to be before shapebase calls Parent::onRemove, and also hard sets the mMaterialList to NULL when setMaterialList is called
This commit is contained in:
marauder2k7 2026-03-23 12:22:54 +00:00
parent b742f399e4
commit 4a0a7d2b10
2 changed files with 14 additions and 8 deletions

View file

@ -1164,13 +1164,6 @@ void ShapeBase::onRemove()
{
mConvexList->nukeList();
Parent::onRemove();
// Stop any running sounds on the client
if (isGhost())
for (S32 i = 0; i < MaxSoundThreads; i++)
stopAudio(i);
// Accumulation and environment mapping
if (isClientObject() && mShapeInstance)
{
@ -1178,6 +1171,13 @@ void ShapeBase::onRemove()
AccumulationVolume::removeObject(this);
}
Parent::onRemove();
// Stop any running sounds on the client
if (isGhost())
for (S32 i = 0; i < MaxSoundThreads; i++)
stopAudio(i);
if ( isClientObject() )
{
if (mCubeReflector)

View file

@ -239,8 +239,11 @@ void TSShapeInstance::initMeshObjects()
void TSShapeInstance::setMaterialList( TSMaterialList *matList )
{
// get rid of old list
if ( mOwnMaterialList )
if (mOwnMaterialList)
{
delete mMaterialList;
mMaterialList = NULL;
}
mMaterialList = matList;
mOwnMaterialList = false;
@ -891,6 +894,9 @@ void TSShapeInstance::prepCollision()
// Returns true is the shape contains any materials with accumulation enabled.
bool TSShapeInstance::hasAccumulation()
{
if (!mOwnMaterialList || mMaterialList == NULL)
return false;
bool result = false;
for ( U32 i = 0; i < mMaterialList->size(); ++i )
{