summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2009-09-29 09:09:01 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2009-09-29 11:29:26 (GMT)
commitb2d756ff77ff4446499292ffbaede38ab5d0e894 (patch)
tree45345e0dd3c736ee4efa08bf990268cc48b7b1d9
parent7931a2eda156a4250f4d0283c2b6b0d5434bbecd (diff)
downloadQt-b2d756ff77ff4446499292ffbaede38ab5d0e894.zip
Qt-b2d756ff77ff4446499292ffbaede38ab5d0e894.tar.gz
Qt-b2d756ff77ff4446499292ffbaede38ab5d0e894.tar.bz2
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
-rw-r--r--src/opengl/qgl.cpp5
1 files 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
}