Skip to content

Commit

Permalink
Fixed a bug in the cleanup of sky_sphere transforms.
Browse files Browse the repository at this point in the history
Also cleaned up cleanup (no pun intended) of object transforms along the way.
  • Loading branch information
c-lipka committed Feb 18, 2016
1 parent 373f727 commit 0f349a7
Show file tree
Hide file tree
Showing 25 changed files with 22 additions and 49 deletions.
6 changes: 6 additions & 0 deletions source/core/scene/atmosphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,12 @@ void Destroy_Skysphere(SKYSPHERE *Skysphere)
delete Skysphere;
}

Skysphere_Struct::~Skysphere_Struct()
{
for (vector<PIGMENT*>::iterator i = Pigments.begin(); i != Pigments.end(); ++ i)
delete *i;
Destroy_Transform(Trans);
}


/*****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion source/core/scene/atmosphere.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct Rainbow_Struct
struct Skysphere_Struct
{
Skysphere_Struct() : Trans(NULL) {}
~Skysphere_Struct() { for (vector<PIGMENT*>::iterator i = Pigments.begin(); i != Pigments.end(); ++ i) delete *i; if (Trans) POV_FREE(Trans); }
~Skysphere_Struct();
MathColour Emission; ///< Brightness adjustment.
vector<PIGMENT *> Pigments; ///< Pigment(s) to use.
TRANSFORM * Trans; ///< Skysphere transformation.
Expand Down
5 changes: 5 additions & 0 deletions source/core/scene/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,11 @@ void Destroy_Object(ObjectPtr Object)
}
}

ObjectBase::~ObjectBase()
{
Destroy_Transform(Trans);
}


/*****************************************************************************
*
Expand Down
2 changes: 1 addition & 1 deletion source/core/scene/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class ObjectBase
o.LLights.clear();
}
}
virtual ~ObjectBase() { }
virtual ~ObjectBase();

virtual ObjectPtr Copy() = 0;

Expand Down
1 change: 0 additions & 1 deletion source/core/shape/blob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,6 @@ Blob_List_Struct *Blob::Create_Blob_List_Element()

Blob::~Blob()
{
Destroy_Transform(Trans);
for (vector<TEXTURE*>::iterator i = Element_Texture.begin(); i != Element_Texture.end(); ++i)
Destroy_Textures(*i);
if (Data != NULL)
Expand Down
4 changes: 1 addition & 3 deletions source/core/shape/box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,9 +903,7 @@ ObjectPtr Box::Copy()
******************************************************************************/

Box::~Box()
{
Destroy_Transform(Trans);
}
{}



Expand Down
4 changes: 1 addition & 3 deletions source/core/shape/cone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,9 +883,7 @@ void Cone::Compute_Cylinder_Data()
******************************************************************************/

Cone::~Cone()
{
Destroy_Transform(Trans);
}
{}



Expand Down
4 changes: 1 addition & 3 deletions source/core/shape/disc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,7 @@ ObjectPtr Disc::Copy()
******************************************************************************/

Disc::~Disc()
{
Destroy_Transform(Trans);
}
{}



Expand Down
4 changes: 1 addition & 3 deletions source/core/shape/fractal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,7 @@ ObjectPtr Fractal::Copy()
******************************************************************************/

Fractal::~Fractal()
{
Destroy_Transform(Trans);
}
{}

/*****************************************************************************
*
Expand Down
2 changes: 0 additions & 2 deletions source/core/shape/heightfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1297,8 +1297,6 @@ HField::~HField()
{
int i;

Destroy_Transform(Trans);

if (--(Data->References) == 0)
{
if (Data->Map != NULL)
Expand Down
1 change: 0 additions & 1 deletion source/core/shape/isosurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,6 @@ IsoSurface::~IsoSurface()
if(--mginfo->refcnt == 0)
POV_FREE(mginfo);
delete Function;
Destroy_Transform(Trans);
}

/*****************************************************************************
Expand Down
2 changes: 0 additions & 2 deletions source/core/shape/lathe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,6 @@ ObjectPtr Lathe::Copy()

Lathe::~Lathe()
{
Destroy_Transform(Trans);

if (--(Spline->References) == 0)
{
Destroy_BCyl(Spline->BCyl);
Expand Down
2 changes: 0 additions & 2 deletions source/core/shape/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,6 @@ Mesh::~Mesh()
{
MeshIndex i;

Destroy_Transform(Trans);

/* NK 1999 move texture outside of data block */
if (Textures != NULL)
{
Expand Down
4 changes: 1 addition & 3 deletions source/core/shape/ovus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,9 +774,7 @@ ObjectPtr Ovus::Copy()
******************************************************************************/

Ovus::~Ovus()
{
Destroy_Transform(Trans);
}
{}



Expand Down
1 change: 0 additions & 1 deletion source/core/shape/parametric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@ ObjectPtr Parametric::Copy()

Parametric::~Parametric()
{
Destroy_Transform(Trans);
delete Function[0];
delete Function[1];
delete Function[2];
Expand Down
4 changes: 1 addition & 3 deletions source/core/shape/plane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,7 @@ ObjectPtr Plane::Copy()
******************************************************************************/

Plane::~Plane()
{
Destroy_Transform(Trans);
}
{}



Expand Down
2 changes: 0 additions & 2 deletions source/core/shape/polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,6 @@ Polygon::~Polygon()

POV_FREE (Data);
}

Destroy_Transform(Trans);
}


Expand Down
2 changes: 0 additions & 2 deletions source/core/shape/polynomial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1455,8 +1455,6 @@ ObjectPtr Poly::Copy()

Poly::~Poly()
{
Destroy_Transform(Trans);

POV_FREE(Coeffs);
}

Expand Down
2 changes: 0 additions & 2 deletions source/core/shape/prism.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,8 +1031,6 @@ ObjectPtr Prism::Copy()

Prism::~Prism()
{
Destroy_Transform(Trans);

if (--(Spline->References) == 0)
{
POV_FREE(Spline->Entry);
Expand Down
2 changes: 0 additions & 2 deletions source/core/shape/sor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -860,8 +860,6 @@ ObjectPtr Sor::Copy()

Sor::~Sor()
{
Destroy_Transform(Trans);

if (--(Spline->References) == 0)
{
Destroy_BCyl(Spline->BCyl);
Expand Down
1 change: 0 additions & 1 deletion source/core/shape/sphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,6 @@ Sphere::~Sphere()
Debug_Info("}\n");
#endif

Destroy_Transform(Trans);
Destroy_Transform(UV_Trans);
}

Expand Down
2 changes: 0 additions & 2 deletions source/core/shape/spheresweep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1290,8 +1290,6 @@ void SphereSweep::Transform(const TRANSFORM *tr)

SphereSweep::~SphereSweep()
{
Destroy_Transform(Trans);

POV_FREE(Modeling_Sphere);
POV_FREE(Sphere);
POV_FREE(Segment);
Expand Down
4 changes: 1 addition & 3 deletions source/core/shape/superellipsoid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,7 @@ ObjectPtr Superellipsoid::Copy()
******************************************************************************/

Superellipsoid::~Superellipsoid()
{
Destroy_Transform(Trans);
}
{}



Expand Down
4 changes: 1 addition & 3 deletions source/core/shape/torus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,7 @@ ObjectPtr SpindleTorus::Copy()
******************************************************************************/

Torus::~Torus()
{
Destroy_Transform(Trans);
}
{}

SpindleTorus::~SpindleTorus()
{}
Expand Down
4 changes: 1 addition & 3 deletions source/core/shape/truetype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2943,9 +2943,7 @@ TrueType::TrueType() : ObjectBase(TTF_OBJECT)
}

TrueType::~TrueType()
{
Destroy_Transform(Trans);
}
{}



Expand Down

0 comments on commit 0f349a7

Please sign in to comment.