diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-10-20 12:54:22 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-10-20 12:58:38 (GMT) |
commit | bdb67474ece69a987379411f593d0b37c1400746 (patch) | |
tree | 81238586d1ebf593f03016cb1db30f034effa44e /src/opengl | |
parent | f0a7e831394683190faf8a51bf724462f98568e9 (diff) | |
download | Qt-bdb67474ece69a987379411f593d0b37c1400746.zip Qt-bdb67474ece69a987379411f593d0b37c1400746.tar.gz Qt-bdb67474ece69a987379411f593d0b37c1400746.tar.bz2 |
Make sure QGLTextureCache exists when creating surfaces for pixmaps
QGLTextureCache installs pixmap cleanup hooks which are used to clean up
the EGL surfaces.
Reviewed-By: Trustme
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qgl_x11egl.cpp | 8 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_x11gl.cpp | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index fb08741..3894ed1 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -521,6 +521,14 @@ bool Q_OPENGL_EXPORT qt_createEGLSurfaceForPixmap(QPixmapData* pmd, bool readOnl return false; } + static bool doneOnce = false; + if (!doneOnce) { + // Make sure QGLTextureCache is instanciated so it can install cleanup hooks + // which cleanup the EGL surface. + QGLTextureCache::instance(); + doneOnce = true; + } + Q_ASSERT(sizeof(Qt::HANDLE) >= sizeof(EGLSurface)); // Just to make totally sure! pixmapData->gl_surface = (Qt::HANDLE)pixmapSurface; pixmapData->is_cached = true; // Make sure the cleanup hook gets called diff --git a/src/opengl/qwindowsurface_x11gl.cpp b/src/opengl/qwindowsurface_x11gl.cpp index 2e05ab3..8ef239d 100644 --- a/src/opengl/qwindowsurface_x11gl.cpp +++ b/src/opengl/qwindowsurface_x11gl.cpp @@ -53,12 +53,10 @@ QT_BEGIN_NAMESPACE QX11GLWindowSurface::QX11GLWindowSurface(QWidget* window) : QWindowSurface(window), m_GC(0), m_window(window) { - QImagePixmapCleanupHooks::instance(); } QX11GLWindowSurface::~QX11GLWindowSurface() { - if (m_GC) XFree(m_GC); } |