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