diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-07-02 11:16:45 (GMT) |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-07-21 13:54:50 (GMT) |
commit | fdacdd4335f80aea8385b5cfb745df9eda99ece6 (patch) | |
tree | 3f6ec22dff875ec124f926625124108afc70d7da /src/opengl | |
parent | 6aeb2f208f2978f1445ba2ac0043491db75359aa (diff) | |
download | Qt-fdacdd4335f80aea8385b5cfb745df9eda99ece6.zip Qt-fdacdd4335f80aea8385b5cfb745df9eda99ece6.tar.gz Qt-fdacdd4335f80aea8385b5cfb745df9eda99ece6.tar.bz2 |
Fixed crash in the GL2 engine's texture glyph cache.
Reviewed-by: Tom
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 939cd0d..3007b4c 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -115,6 +115,7 @@ public Q_SLOTS: glDeleteFramebuffers(1, &m_fbo); if (m_width || m_height) glDeleteTextures(1, &m_texture); + ctx = 0; } else { // since the context holding the texture is shared, and // about to be destroyed, we have to transfer ownership @@ -151,10 +152,17 @@ QGLTextureGlyphCache::QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyph QGLTextureGlyphCache::~QGLTextureGlyphCache() { - glDeleteFramebuffers(1, &m_fbo); - - if (m_width || m_height) - glDeleteTextures(1, &m_texture); + if (ctx) { + QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext()); + if (oldContext != ctx) + ctx->makeCurrent(); + glDeleteFramebuffers(1, &m_fbo); + + if (m_width || m_height) + glDeleteTextures(1, &m_texture); + if (oldContext && oldContext != ctx) + oldContext->makeCurrent(); + } } void QGLTextureGlyphCache::createTextureData(int width, int height) |