diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-04-28 09:31:10 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-04-28 10:05:33 +0300 |
commit | d5fe794178f755a259e7680bbf11571785abe14d (patch) | |
tree | c96ef2f5c6f707b4639fdd740f91f8e2679c63e7 /src/datavisualization/utils/texturehelper.cpp | |
parent | ac276e4f176844e6048ad3eb7b4de5eed7eaefcf (diff) |
Fix texture cleanup.
Make deleteTexture also zero the pointer and do the check if
deletion is needed, as those are required anyway on the caller
side in most cases.
Change-Id: Ia12102c97a647127230db2518c32f81322ce6743
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'src/datavisualization/utils/texturehelper.cpp')
-rw-r--r-- | src/datavisualization/utils/texturehelper.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/datavisualization/utils/texturehelper.cpp b/src/datavisualization/utils/texturehelper.cpp index 07130d7e..185d99e4 100644 --- a/src/datavisualization/utils/texturehelper.cpp +++ b/src/datavisualization/utils/texturehelper.cpp @@ -241,9 +241,12 @@ void TextureHelper::fillDepthTexture(GLuint texture,const QSize &size, GLuint te } #endif -void TextureHelper::deleteTexture(const GLuint *texture) +void TextureHelper::deleteTexture(GLuint *texture) { - glDeleteTextures(1, texture); + if (texture && *texture) { + glDeleteTextures(1, texture); + *texture = 0; + } } QImage TextureHelper::convertToGLFormat(const QImage &srcImage) |