summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authorJani Hautakangas <jani.hautakangas@nokia.com>2011-11-30 12:41:39 (GMT)
committerJani Hautakangas <jani.hautakangas@nokia.com>2011-11-30 13:23:47 (GMT)
commit8752faf0564bed86396b01529dc8ef5064150f4c (patch)
treec398d5b2b7ad4af203ffeef1f89a994e54804ac8 /src/openvg
parent9a5fb6bd5f0fb3b37897bf722e4cc1673309623c (diff)
downloadQt-8752faf0564bed86396b01529dc8ef5064150f4c.zip
Qt-8752faf0564bed86396b01529dc8ef5064150f4c.tar.gz
Qt-8752faf0564bed86396b01529dc8ef5064150f4c.tar.bz2
Fix memory leaks in OpenVG and OpenGL resource pools
Task-number: QTBUG-22743 Reviewed-by: Murray Read
Diffstat (limited to 'src/openvg')
-rw-r--r--src/openvg/qvgimagepool.cpp13
-rw-r--r--src/openvg/qvgimagepool_p.h4
2 files changed, 2 insertions, 15 deletions
diff --git a/src/openvg/qvgimagepool.cpp b/src/openvg/qvgimagepool.cpp
index 3a187b0..cd1caf4 100644
--- a/src/openvg/qvgimagepool.cpp
+++ b/src/openvg/qvgimagepool.cpp
@@ -44,7 +44,7 @@
QT_BEGIN_NAMESPACE
-static QVGImagePool *qt_vg_image_pool = 0;
+Q_GLOBAL_STATIC(QVGImagePool, qt_vg_image_pool)
class QVGImagePoolPrivate
{
@@ -66,16 +66,7 @@ QVGImagePool::~QVGImagePool()
QVGImagePool *QVGImagePool::instance()
{
- 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;
+ return qt_vg_image_pool();
}
VGImage QVGImagePool::createTemporaryImage(VGImageFormat format,
diff --git a/src/openvg/qvgimagepool_p.h b/src/openvg/qvgimagepool_p.h
index 07c57bf..e4fd4e1 100644
--- a/src/openvg/qvgimagepool_p.h
+++ b/src/openvg/qvgimagepool_p.h
@@ -69,10 +69,6 @@ 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.