Try to avoid some memory leaks.
This commit is contained in:
parent
fb54e9e103
commit
1341b5b9f8
@ -46,11 +46,13 @@ SGCloudLayer::SGCloudLayer( const string &tex_path )
|
|||||||
layer_transition(0),
|
layer_transition(0),
|
||||||
layer_type(SG_CLOUD_CLEAR)
|
layer_type(SG_CLOUD_CLEAR)
|
||||||
{
|
{
|
||||||
rebuild();
|
rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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)
|
||||||
{
|
{
|
||||||
layer_span = span_m;
|
if (span_m != layer_span) {
|
||||||
|
layer_span = span_m;
|
||||||
|
rebuild();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
@ -110,8 +115,10 @@ SGCloudLayer::getType () const
|
|||||||
void
|
void
|
||||||
SGCloudLayer::setType (Type type)
|
SGCloudLayer::setType (Type type)
|
||||||
{
|
{
|
||||||
layer_type = type;
|
if (type != layer_type) {
|
||||||
rebuild();
|
layer_type = type;
|
||||||
|
rebuild();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user