From b2d756ff77ff4446499292ffbaede38ab5d0e894 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 29 Sep 2009 11:09:01 +0200 Subject: Fix EGL/GLX surface leak when using texture-from-pixmap The QScopedPointer changes mean that the pixmap data's reference count is now decremented after the cleanup hooks are called. The hooks should also only be called when the pixmap data gets deleted, so we don't actually have to check the reference count at all. Reviewed-by: TrustMe --- src/opengl/qgl.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 0ad6772..1276443 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1624,9 +1624,8 @@ void QGLTextureCache::pixmapCleanupHook(QPixmap* pixmap) } #if defined(Q_WS_X11) QPixmapData *pd = pixmap->data_ptr().data(); - // Only need to delete the gl surface if the pixmap is about to be deleted - if (pd->ref == 0) - QGLContextPrivate::destroyGlSurfaceForPixmap(pd); + Q_ASSERT(pd->ref == 1); // Make sure reference counting isn't broken + QGLContextPrivate::destroyGlSurfaceForPixmap(pd); #endif } -- cgit v0.12