Fixes a memory leak in the VolumetricFog object and corrects an array alloc mismatch. Once objects were being deleted on the client, the SAFE_DELETE(z_buf) needed to be removed from the destructor. This was causing a runtime crash (release only) because z_buf was still registered with the GFX device.

This commit is contained in:
OTHGMars 2017-05-06 20:57:10 -04:00
parent a6710285db
commit 3658f1587d

View file

@ -142,7 +142,7 @@ VolumetricFog::VolumetricFog()
VolumetricFog::~VolumetricFog()
{
if (isClientObject())
if (!isClientObject())
return;
for (S32 i = 0; i < det_size.size(); i++)
@ -152,12 +152,11 @@ VolumetricFog::~VolumetricFog()
if (det_size[i].piArray != NULL)
delete(det_size[i].piArray);
if (det_size[i].verts != NULL)
delete(det_size[i].verts);
delete [] (det_size[i].verts);
}
det_size.clear();
if (z_buf.isValid())
SAFE_DELETE(z_buf);
z_buf = NULL;
if (!mTexture.isNull())
mTexture.free();
@ -365,7 +364,7 @@ bool VolumetricFog::LoadShape()
if (det_size[i].piArray != NULL)
delete(det_size[i].piArray);
if (det_size[i].verts != NULL)
delete(det_size[i].verts);
delete [] (det_size[i].verts);
}
det_size.clear();