From 09449825551798a09c2bf18daea18e8e2abe93bc Mon Sep 17 00:00:00 2001 From: mread Date: Mon, 12 Dec 2011 13:10:28 +0000 Subject: Revert "Fix memory leaks in OpenVG and OpenGL resource pools" This reverts commit 8752faf0564bed86396b01529dc8ef5064150f4c. Also Revert "Fix def files" This reverts commit d2a3b9ee8c9329cac96b5e509df0e6a69dbef91c. This was found to cause a crash in QMLGallery app. It is not necessary to delete these resource pools at app exit, as the OS should automatically release the resources at this point. Reviewed-by: Jani Hautakangas --- src/opengl/qgltexturepool.cpp | 6 ++++-- src/openvg/qvgimagepool.cpp | 13 +++++++++++-- src/openvg/qvgimagepool_p.h | 4 ++++ src/s60installs/bwins/QtOpenVGu.def | 2 +- src/s60installs/eabi/QtOpenVGu.def | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/opengl/qgltexturepool.cpp b/src/opengl/qgltexturepool.cpp index d19b1db..9ad66f2 100644 --- a/src/opengl/qgltexturepool.cpp +++ b/src/opengl/qgltexturepool.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE Q_OPENGL_EXPORT extern QGLWidget* qt_gl_share_widget(); -Q_GLOBAL_STATIC(QGLTexturePool, qt_gl_texture_pool) +static QGLTexturePool *qt_gl_texture_pool = 0; class QGLTexturePoolPrivate { @@ -69,7 +69,9 @@ QGLTexturePool::~QGLTexturePool() QGLTexturePool *QGLTexturePool::instance() { - return qt_gl_texture_pool(); + if (!qt_gl_texture_pool) + qt_gl_texture_pool = new QGLTexturePool(); + return qt_gl_texture_pool; } GLuint QGLTexturePool::createTexture(GLenum target, diff --git a/src/openvg/qvgimagepool.cpp b/src/openvg/qvgimagepool.cpp index cd1caf4..3a187b0 100644 --- a/src/openvg/qvgimagepool.cpp +++ b/src/openvg/qvgimagepool.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QVGImagePool, qt_vg_image_pool) +static QVGImagePool *qt_vg_image_pool = 0; class QVGImagePoolPrivate { @@ -66,7 +66,16 @@ QVGImagePool::~QVGImagePool() QVGImagePool *QVGImagePool::instance() { - return qt_vg_image_pool(); + if (!qt_vg_image_pool) + qt_vg_image_pool = new QVGImagePool(); + return qt_vg_image_pool; +} + +void QVGImagePool::setImagePool(QVGImagePool *pool) +{ + if (qt_vg_image_pool != pool) + delete qt_vg_image_pool; + qt_vg_image_pool = pool; } VGImage QVGImagePool::createTemporaryImage(VGImageFormat format, diff --git a/src/openvg/qvgimagepool_p.h b/src/openvg/qvgimagepool_p.h index e4fd4e1..07c57bf 100644 --- a/src/openvg/qvgimagepool_p.h +++ b/src/openvg/qvgimagepool_p.h @@ -69,6 +69,10 @@ public: static QVGImagePool *instance(); + // This function can be used from system-specific graphics system + // plugins to alter the image allocation strategy. + static void setImagePool(QVGImagePool *pool); + // Create a new VGImage from the pool with the specified parameters // that is not associated with a pixmap. The VGImage is returned to // the pool when releaseImage() is called. diff --git a/src/s60installs/bwins/QtOpenVGu.def b/src/s60installs/bwins/QtOpenVGu.def index dc1ddce..547931e 100644 --- a/src/s60installs/bwins/QtOpenVGu.def +++ b/src/s60installs/bwins/QtOpenVGu.def @@ -159,7 +159,7 @@ EXPORTS ?hibernate@QVGImagePool@@UAEXXZ @ 158 NONAME ; void QVGImagePool::hibernate(void) ?qt_vg_destroy_context@@YAXPAVQEglContext@@H@Z @ 159 NONAME ; void qt_vg_destroy_context(class QEglContext *, int) ??0QVGImagePool@@QAE@XZ @ 160 NONAME ; QVGImagePool::QVGImagePool(void) - ?setImagePool@QVGImagePool@@SAXPAV1@@Z @ 161 NONAME ABSENT ; void QVGImagePool::setImagePool(class QVGImagePool *) + ?setImagePool@QVGImagePool@@SAXPAV1@@Z @ 161 NONAME ; void QVGImagePool::setImagePool(class QVGImagePool *) ?pixmapLRU@QVGImagePool@@IAEPAVQVGPixmapData@@XZ @ 162 NONAME ; class QVGPixmapData * QVGImagePool::pixmapLRU(void) ?qt_vg_create_context@@YAPAVQEglContext@@PAVQPaintDevice@@H@Z @ 163 NONAME ; class QEglContext * qt_vg_create_context(class QPaintDevice *, int) ?reclaimImages@QVGPixmapData@@UAEXXZ @ 164 NONAME ; void QVGPixmapData::reclaimImages(void) diff --git a/src/s60installs/eabi/QtOpenVGu.def b/src/s60installs/eabi/QtOpenVGu.def index f87c71d..a66df98 100644 --- a/src/s60installs/eabi/QtOpenVGu.def +++ b/src/s60installs/eabi/QtOpenVGu.def @@ -176,7 +176,7 @@ EXPORTS _ZN12QVGImagePool11detachImageEP13QVGPixmapData @ 175 NONAME _ZN12QVGImagePool12reclaimSpaceE13VGImageFormatllP13QVGPixmapData @ 176 NONAME _ZN12QVGImagePool12releaseImageEP13QVGPixmapDatam @ 177 NONAME - _ZN12QVGImagePool12setImagePoolEPS_ @ 178 NONAME ABSENT + _ZN12QVGImagePool12setImagePoolEPS_ @ 178 NONAME _ZN12QVGImagePool13removeFromLRUEP13QVGPixmapData @ 179 NONAME _ZN12QVGImagePool15moveToHeadOfLRUEP13QVGPixmapData @ 180 NONAME _ZN12QVGImagePool20createImageForPixmapE13VGImageFormatllmP13QVGPixmapData @ 181 NONAME -- cgit v0.12