summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-12-12 13:10:28 (GMT)
committermread <qt-info@nokia.com>2011-12-12 13:38:57 (GMT)
commit09449825551798a09c2bf18daea18e8e2abe93bc (patch)
treee3d6cb9d8209ebcf9d84b320fb627e86f5987878 /src/openvg
parent54613aec3bdac668d198923814873a9e622ad675 (diff)
downloadQt-09449825551798a09c2bf18daea18e8e2abe93bc.zip
Qt-09449825551798a09c2bf18daea18e8e2abe93bc.tar.gz
Qt-09449825551798a09c2bf18daea18e8e2abe93bc.tar.bz2
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/openvg')
-rw-r--r--src/openvg/qvgimagepool.cpp13
-rw-r--r--src/openvg/qvgimagepool_p.h4
2 files changed, 15 insertions, 2 deletions
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.