Browse Source

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.

OTHGMars 8 years ago
parent
commit
84c74ce326
1 changed files with 4 additions and 5 deletions
  1. 4 5
      Engine/source/environment/VolumetricFog.cpp

+ 4 - 5
Engine/source/environment/VolumetricFog.cpp

@@ -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();