From ab29063a974b1262365112f68a1823d59d99e9b1 Mon Sep 17 00:00:00 2001 From: ehofman Date: Sun, 4 Apr 2004 15:35:28 +0000 Subject: [PATCH] Frederic: The state selector was not referenced and got deleted as soon as the sky was rebuilt a second time with the metar code. --- simgear/scene/sky/cloud.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/simgear/scene/sky/cloud.cxx b/simgear/scene/sky/cloud.cxx index 1bd5dcee..7042c568 100644 --- a/simgear/scene/sky/cloud.cxx +++ b/simgear/scene/sky/cloud.cxx @@ -167,6 +167,7 @@ SGCloudLayer::rebuild() ssgSimpleState *state; state_sel = new ssgStateSelector( 2 ); + state_sel->ref(); cloud_path.set(texture_path.str()); cloud_path.append("overcast.rgb"); state_sel->setStep( 0, sgCloudMakeState(cloud_path.str()) ); @@ -176,6 +177,7 @@ SGCloudLayer::rebuild() layer_states[SG_CLOUD_OVERCAST] = state_sel; state_sel = new ssgStateSelector( 2 ); + state_sel->ref(); cloud_path.set(texture_path.str()); cloud_path.append("broken.rgba"); state = sgCloudMakeState(cloud_path.str()); @@ -184,6 +186,7 @@ SGCloudLayer::rebuild() layer_states[SG_CLOUD_BROKEN] = state_sel; state_sel = new ssgStateSelector( 2 ); + state_sel->ref(); cloud_path.set(texture_path.str()); cloud_path.append("scattered.rgba"); state = sgCloudMakeState(cloud_path.str()); @@ -192,6 +195,7 @@ SGCloudLayer::rebuild() layer_states[SG_CLOUD_SCATTERED] = state_sel; state_sel = new ssgStateSelector( 2 ); + state_sel->ref(); cloud_path.set(texture_path.str()); cloud_path.append("few.rgba"); state = sgCloudMakeState(cloud_path.str()); @@ -200,6 +204,7 @@ SGCloudLayer::rebuild() layer_states[SG_CLOUD_FEW] = state_sel; state_sel = new ssgStateSelector( 2 ); + state_sel->ref(); cloud_path.set(texture_path.str()); cloud_path.append("cirrus.rgba"); state = sgCloudMakeState(cloud_path.str()); @@ -526,9 +531,5 @@ ssgSimpleState *sgCloudMakeState( const string &path ) { state->enable( GL_ALPHA_TEST ); state->setAlphaClamp( 0.01 ); - // ref() the state so it doesn't get deleted if the last layer of - // it's type is deleted. - state->ref(); - return state; } -- 2.39.5