Skip to content

Commit 0f349a7

Browse files
committed
Fixed a bug in the cleanup of sky_sphere transforms.
Also cleaned up cleanup (no pun intended) of object transforms along the way.
1 parent 373f727 commit 0f349a7

25 files changed

+22
-49
lines changed

source/core/scene/atmosphere.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,12 @@ void Destroy_Skysphere(SKYSPHERE *Skysphere)
452452
delete Skysphere;
453453
}
454454

455+
Skysphere_Struct::~Skysphere_Struct()
456+
{
457+
for (vector<PIGMENT*>::iterator i = Pigments.begin(); i != Pigments.end(); ++ i)
458+
delete *i;
459+
Destroy_Transform(Trans);
460+
}
455461

456462

457463
/*****************************************************************************

source/core/scene/atmosphere.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ struct Rainbow_Struct
9696
struct Skysphere_Struct
9797
{
9898
Skysphere_Struct() : Trans(NULL) {}
99-
~Skysphere_Struct() { for (vector<PIGMENT*>::iterator i = Pigments.begin(); i != Pigments.end(); ++ i) delete *i; if (Trans) POV_FREE(Trans); }
99+
~Skysphere_Struct();
100100
MathColour Emission; ///< Brightness adjustment.
101101
vector<PIGMENT *> Pigments; ///< Pigment(s) to use.
102102
TRANSFORM * Trans; ///< Skysphere transformation.

source/core/scene/object.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,11 @@ void Destroy_Object(ObjectPtr Object)
824824
}
825825
}
826826

827+
ObjectBase::~ObjectBase()
828+
{
829+
Destroy_Transform(Trans);
830+
}
831+
827832

828833
/*****************************************************************************
829834
*

source/core/scene/object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class ObjectBase
206206
o.LLights.clear();
207207
}
208208
}
209-
virtual ~ObjectBase() { }
209+
virtual ~ObjectBase();
210210

211211
virtual ObjectPtr Copy() = 0;
212212

source/core/shape/blob.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2187,7 +2187,6 @@ Blob_List_Struct *Blob::Create_Blob_List_Element()
21872187

21882188
Blob::~Blob()
21892189
{
2190-
Destroy_Transform(Trans);
21912190
for (vector<TEXTURE*>::iterator i = Element_Texture.begin(); i != Element_Texture.end(); ++i)
21922191
Destroy_Textures(*i);
21932192
if (Data != NULL)

source/core/shape/box.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -903,9 +903,7 @@ ObjectPtr Box::Copy()
903903
******************************************************************************/
904904

905905
Box::~Box()
906-
{
907-
Destroy_Transform(Trans);
908-
}
906+
{}
909907

910908

911909

source/core/shape/cone.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -883,9 +883,7 @@ void Cone::Compute_Cylinder_Data()
883883
******************************************************************************/
884884

885885
Cone::~Cone()
886-
{
887-
Destroy_Transform(Trans);
888-
}
886+
{}
889887

890888

891889

source/core/shape/disc.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,7 @@ ObjectPtr Disc::Copy()
501501
******************************************************************************/
502502

503503
Disc::~Disc()
504-
{
505-
Destroy_Transform(Trans);
506-
}
504+
{}
507505

508506

509507

source/core/shape/fractal.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,7 @@ ObjectPtr Fractal::Copy()
697697
******************************************************************************/
698698

699699
Fractal::~Fractal()
700-
{
701-
Destroy_Transform(Trans);
702-
}
700+
{}
703701

704702
/*****************************************************************************
705703
*

source/core/shape/heightfield.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,8 +1297,6 @@ HField::~HField()
12971297
{
12981298
int i;
12991299

1300-
Destroy_Transform(Trans);
1301-
13021300
if (--(Data->References) == 0)
13031301
{
13041302
if (Data->Map != NULL)

0 commit comments

Comments
 (0)