From d5fe794178f755a259e7680bbf11571785abe14d Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 28 Apr 2014 09:31:10 +0300 Subject: Fix texture cleanup. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ää --- src/datavisualization/utils/texturehelper.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/datavisualization/utils/texturehelper.cpp') 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) -- cgit v1.2.3