diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-10-22 13:51:30 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-10-23 18:13:12 +0200 |
commit | ab79e832e602b6366340151720b8c7c7b7ddb1a3 (patch) | |
tree | 215bd32ebd92596353bba13cba4366ed4004ceac | |
parent | c1fc54027358ab4fb09eb36d6ea83777392d995f (diff) |
Do not parent the shader program to the QOpenGLContext
When the last QOpenGLContext in a share group is destroyed, all the
remaining alive QOpenGL* objects have their resource invalidated.
This happens under QOpenGLContext::destroy, but before any QObject
children of the QOpenGLContext is destroyed by the QObject destructor.
This is currently an issue with ANGLE that could be fixed in its own
code, but that is still better for us to be covered against.
This means that the OpenGL resource is assumed to be destroyed with
the context by the driver, but this isn't always the same.
Fix an instance of this in QOpenGLTextureGlyphCache by explicitly
owning the blit QOpenGLShaderProgram instead of parenting it under
the current GL context. The very same resource invalidation system
will prevent anything bad to happen if the QOpenGLContext is
destroyed before the QOpenGLTextureGlyphCache.
Task-number: QTBUG-41588
Change-Id: Ic3bc69b07bcbdcf7d699ea9139b2e34b04e642e5
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
-rw-r--r-- | src/gui/opengl/qopengltextureglyphcache.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 6e16b2df75..0f70a01014 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -240,7 +240,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) QOpenGLShaderProgram *blitProgram = 0; if (pex == 0) { if (m_blitProgram == 0) { - m_blitProgram = new QOpenGLShaderProgram(ctx); + m_blitProgram = new QOpenGLShaderProgram; const bool isCoreProfile = ctx->format().profile() == QSurfaceFormat::CoreProfile; { @@ -444,6 +444,9 @@ void QOpenGLTextureGlyphCache::clear() m_textureResource->free(); m_textureResource = 0; + delete m_blitProgram; + m_blitProgram = 0; + m_w = 0; m_h = 0; m_cx = 0; |