diff -r dee5afe5301f -r 3f74d0d4af4c src/gui/image/qpixmapdata.cpp --- a/src/gui/image/qpixmapdata.cpp Mon Mar 15 12:43:09 2010 +0200 +++ b/src/gui/image/qpixmapdata.cpp Thu Apr 08 14:19:33 2010 +0300 @@ -45,6 +45,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -80,6 +81,16 @@ QPixmapData::~QPixmapData() { + // Sometimes the pixmap cleanup hooks will be called from derrived classes, which will + // then set is_cached to false. For example, on X11 QtOpenGL needs to delete the GLXPixmap + // or EGL Pixmap Surface for a given pixmap _before_ the native X11 pixmap is deleted, + // otherwise some drivers will leak the GL surface. In this case, QX11PixmapData will + // call the cleanup hooks itself before deleting the native pixmap and set is_cached to + // false. + if (is_cached) { + QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(this); + is_cached = false; + } } QPixmapData *QPixmapData::createCompatiblePixmapData() const