From db1966c1563955167e9fac6cf79acda7ad7e0f16 Mon Sep 17 00:00:00 2001 From: curt Date: Wed, 9 Jul 2003 20:58:39 +0000 Subject: [PATCH] A couple more sanity checking tweaks for texture freeing. --- simgear/screen/texture.cxx | 6 ++++-- simgear/screen/texture.hxx | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/simgear/screen/texture.cxx b/simgear/screen/texture.cxx index 62e8c74b..338fd113 100644 --- a/simgear/screen/texture.cxx +++ b/simgear/screen/texture.cxx @@ -35,11 +35,13 @@ SGTexture::SGTexture(unsigned int width, unsigned int height) SGTexture::~SGTexture() { - if (texture_data) + if ( texture_data ) { delete texture_data; + } - if (texture_id) + if ( texture_id >= 0 ) { free_id(); + } } void diff --git a/simgear/screen/texture.hxx b/simgear/screen/texture.hxx index 71609c50..083c6036 100644 --- a/simgear/screen/texture.hxx +++ b/simgear/screen/texture.hxx @@ -67,6 +67,7 @@ protected: #else glDeleteTexturesEXT(1, &texture_id); #endif + texture_id = -1; } -- 2.39.5