aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2017-07-24 15:00:37 +0200
committerMitch Curtis <mitch.curtis@qt.io>2017-07-26 08:10:27 +0000
commit39061af50cc3092289cdd71d17802139590ecb59 (patch)
tree913ee31a7e11fc9e3e33a05f53b5d558c6902077 /src/quick
parent264989606420f940cdab14f3f39362b9c82c3885 (diff)
Fix memory leak in QSGAtlasTexture::Manager::create()
Parent the Atlas to the manager. Task-number: QTBUG-61754 Change-Id: Ida8b0622d1dbcaafa622f72a1d210969fa61d5bf Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp7
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture_p.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index 22f0b13f46..d5f836a525 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -116,7 +116,7 @@ QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel)
Texture *t = 0;
if (image.width() < m_atlas_size_limit && image.height() < m_atlas_size_limit) {
if (!m_atlas)
- m_atlas = new Atlas(m_atlas_size);
+ m_atlas = new Atlas(m_atlas_size, this);
// t may be null for atlas allocation failure
t = m_atlas->create(image);
if (t && !hasAlphaChannel && t->hasAlphaChannel())
@@ -125,8 +125,9 @@ QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel)
return t;
}
-Atlas::Atlas(const QSize &size)
- : m_allocator(size)
+Atlas::Atlas(const QSize &size, QObject *parent)
+ : QObject(parent)
+ , m_allocator(size)
, m_texture_id(0)
, m_size(size)
, m_atlas_transient_image_threshold(0)
diff --git a/src/quick/scenegraph/util/qsgatlastexture_p.h b/src/quick/scenegraph/util/qsgatlastexture_p.h
index 3dee539547..0bb07e8e89 100644
--- a/src/quick/scenegraph/util/qsgatlastexture_p.h
+++ b/src/quick/scenegraph/util/qsgatlastexture_p.h
@@ -88,7 +88,7 @@ private:
class Atlas : public QObject
{
public:
- Atlas(const QSize &size);
+ Atlas(const QSize &size, QObject *parent);
~Atlas();
void invalidate();