Try to avoid some memory leaks.

This commit is contained in:
david 2002-06-05 15:43:04 +00:00
parent fb54e9e103
commit 1341b5b9f8

View File

@ -50,7 +50,9 @@ SGCloudLayer::SGCloudLayer( const string &tex_path )
} }
// Destructor // Destructor
SGCloudLayer::~SGCloudLayer( void ) { SGCloudLayer::~SGCloudLayer()
{
delete layer_root;
} }
float float
@ -62,7 +64,10 @@ SGCloudLayer::getSpan_m () const
void void
SGCloudLayer::setSpan_m (float span_m) SGCloudLayer::setSpan_m (float span_m)
{ {
if (span_m != layer_span) {
layer_span = span_m; layer_span = span_m;
rebuild();
}
} }
float float
@ -110,9 +115,11 @@ SGCloudLayer::getType () const
void void
SGCloudLayer::setType (Type type) SGCloudLayer::setType (Type type)
{ {
if (type != layer_type) {
layer_type = type; layer_type = type;
rebuild(); rebuild();
} }
}
// build the cloud object // build the cloud object
@ -143,7 +150,11 @@ SGCloudLayer::rebuild()
layer_states[SG_CLOUD_CLEAR] = 0; layer_states[SG_CLOUD_CLEAR] = 0;
} }
// This should automatically delete
// layer_transform as well.
delete layer_root; delete layer_root;
layer_root = 0;
layer_transform = 0;
scale = 4000.0; scale = 4000.0;