summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill Burtsev <kirill.burtsev@qt.io>2018-11-13 13:38:15 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-11-14 10:24:47 +0000
commite746e55f2451a800744ccfcbc9f83fdc3a16337c (patch)
treef975639f38e89da74de64bfd47b6730720e45500
parent064f0d3d23097cb181166c3e966287490773f23c (diff)
Fix leaking resources by OpenVG scene graph backend
Change-Id: I4e67c639d8343e39673ef5ea08bda7af033fb19f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r--src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.cpp17
-rw-r--r--src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.h1
-rw-r--r--src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp3
3 files changed, 16 insertions, 5 deletions
diff --git a/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.cpp b/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.cpp
index e45b79706b..b5f6b39c60 100644
--- a/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.cpp
+++ b/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.cpp
@@ -174,7 +174,7 @@ void QSGOpenVGRectangleNode::render()
}
-QSGOpenVGImageNode::QSGOpenVGImageNode()
+QSGOpenVGImageNode::QSGOpenVGImageNode() : m_texture(nullptr), m_owns(false)
{
// Set Dummy material and geometry to avoid asserts
setMaterial((QSGMaterial*)1);
@@ -184,9 +184,8 @@ QSGOpenVGImageNode::QSGOpenVGImageNode()
QSGOpenVGImageNode::~QSGOpenVGImageNode()
{
- if (m_owns) {
- m_texture->deleteLater();
- }
+ if (m_owns)
+ delete m_texture;
}
void QSGOpenVGImageNode::setRect(const QRectF &rect)
@@ -212,6 +211,8 @@ QRectF QSGOpenVGImageNode::sourceRect() const
void QSGOpenVGImageNode::setTexture(QSGTexture *texture)
{
+ if (m_owns)
+ delete m_texture;
m_texture = texture;
markDirty(DirtyMaterial);
}
@@ -321,7 +322,7 @@ void QSGOpenVGImageNode::render()
}
-QSGOpenVGNinePatchNode::QSGOpenVGNinePatchNode()
+QSGOpenVGNinePatchNode::QSGOpenVGNinePatchNode() : m_texture(nullptr)
{
// Set Dummy material and geometry to avoid asserts
setMaterial((QSGMaterial*)1);
@@ -329,8 +330,14 @@ QSGOpenVGNinePatchNode::QSGOpenVGNinePatchNode()
}
+QSGOpenVGNinePatchNode::~QSGOpenVGNinePatchNode()
+{
+ delete m_texture;
+}
+
void QSGOpenVGNinePatchNode::setTexture(QSGTexture *texture)
{
+ delete m_texture;
m_texture = texture;
markDirty(DirtyMaterial);
}
diff --git a/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.h b/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.h
index 8e12c27824..e1cd3063a1 100644
--- a/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.h
+++ b/src/plugins/scenegraph/openvg/qsgopenvgpublicnodes.h
@@ -118,6 +118,7 @@ class QSGOpenVGNinePatchNode : public QSGNinePatchNode, public QSGOpenVGRenderab
{
public:
QSGOpenVGNinePatchNode();
+ ~QSGOpenVGNinePatchNode();
void setTexture(QSGTexture *texture) override;
void setBounds(const QRectF &bounds) override;
diff --git a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
index 9493920100..c41dfd7400 100644
--- a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
+++ b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
@@ -43,6 +43,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QElapsedTimer>
+#include <private/qquickanimatorcontroller_p.h>
#include <private/qquickwindow_p.h>
#include <private/qquickprofiler_p.h>
@@ -94,6 +95,8 @@ void QSGOpenVGRenderLoop::windowDestroyed(QQuickWindow *window)
} else if (vg && window == vg->window()) {
vg->doneCurrent();
}
+
+ delete d->animationController;
}
void QSGOpenVGRenderLoop::exposureChanged(QQuickWindow *window)