From: curt Date: Wed, 9 Jul 2003 20:58:39 +0000 (+0000) Subject: A couple more sanity checking tweaks for texture freeing. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=db1966c1563955167e9fac6cf79acda7ad7e0f16;p=simgear.git A couple more sanity checking tweaks for texture freeing. --- 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; }