From 1d58face30c2936657c4372c6237e2fe64e4095b Mon Sep 17 00:00:00 2001 From: Liang Jian Date: Wed, 28 May 2014 12:56:00 +0800 Subject: Fix QOpenGLGlyphTexture object leak Call clear() in the destructor of QOpenGLTextureGlyphCache class to prevent QOpenGLGlyphTexture object leak. Change-Id: I290b09b0786d30603391e6855a21e9232b112739 Reviewed-by: Gunnar Sletta --- src/gui/opengl/qopengltextureglyphcache.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/gui/opengl/qopengltextureglyphcache.cpp') diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index f721d5cb8c5..0610ab60ed4 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -87,6 +87,7 @@ QOpenGLTextureGlyphCache::~QOpenGLTextureGlyphCache() #ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG qDebug(" -> ~QOpenGLTextureGlyphCache() %p.", this); #endif + clear(); } static inline bool isCoreProfile() @@ -447,7 +448,8 @@ int QOpenGLTextureGlyphCache::maxTextureHeight() const void QOpenGLTextureGlyphCache::clear() { - m_textureResource->free(); + if (m_textureResource) + m_textureResource->free(); m_textureResource = 0; m_w = 0; -- cgit v1.2.3