summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-12-12 13:10:28 +0000
committermread <qt-info@nokia.com>2011-12-12 13:38:57 +0000
commit09449825551798a09c2bf18daea18e8e2abe93bc (patch)
treee3d6cb9d8209ebcf9d84b320fb627e86f5987878 /src
parent54613aec3bdac668d198923814873a9e622ad675 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/opengl/qgltexturepool.cpp6
-rw-r--r--src/openvg/qvgimagepool.cpp13
-rw-r--r--src/openvg/qvgimagepool_p.h4
-rw-r--r--src/s60installs/bwins/QtOpenVGu.def2
-rw-r--r--src/s60installs/eabi/QtOpenVGu.def2
5 files changed, 21 insertions, 6 deletions
diff --git a/src/opengl/qgltexturepool.cpp b/src/opengl/qgltexturepool.cpp
index d19b1dbd2d..9ad66f2c3a 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 cd1caf4421..3a187b0112 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 e4fd4e10da..07c57bf44a 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 dc1ddceb1e..547931ea76 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 f87c71d073..a66df98169 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