diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-07-22 15:38:12 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-07-22 17:08:23 (GMT) |
commit | 8768bcfa0000bc216a7f722cd82ac6b06b85a70d (patch) | |
tree | c5b75ce32eef1f92a1ba4909fbce5225afad532b /src/opengl/qgl_x11.cpp | |
parent | d1eca480acd39c478957e39243ff61b55c0113b4 (diff) | |
download | Qt-8768bcfa0000bc216a7f722cd82ac6b06b85a70d.zip Qt-8768bcfa0000bc216a7f722cd82ac6b06b85a70d.tar.gz Qt-8768bcfa0000bc216a7f722cd82ac6b06b85a70d.tar.bz2 |
Plug a texture leak when deleting QPixmaps without a current context
~QGLTexture wouldn't make the texture's context current if the current
context was zero, meaning the texture would leak. This also means
deleteBoundPixmap doesn't need to make the context currnet anymore (as
it's only called from ~QGLTexture).
Reviewed-By: Kim
Diffstat (limited to 'src/opengl/qgl_x11.cpp')
-rw-r--r-- | src/opengl/qgl_x11.cpp | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index 0399b48..d8af4d5 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1630,22 +1630,10 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pm, const qi void QGLTexture::deleteBoundPixmap() { if (boundPixmap) { - // Although glXReleaseTexImage is a glX call, it must be called while there - // is a current context - the context the pixmap was bound to a texture in. - // Otherwise the relese doesn't do anything and you get BadDrawable errors - // when you come to delete the context. - - QGLContext *oldContext = const_cast<QGLContext*>(QGLContext::currentContext()); - if (oldContext != context) - context->makeCurrent(); glXReleaseTexImageEXT(QX11Info::display(), boundPixmap, GLX_FRONT_LEFT_EXT); - if (oldContext && oldContext != context) - oldContext->makeCurrent(); - glXDestroyPixmap(QX11Info::display(), boundPixmap); + boundPixmap = 0; } - - boundPixmap = 0; } |