aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/particles
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-07-27 16:25:38 +1000
committerQt by Nokia <qt-info@nokia.com>2011-07-28 05:14:47 +0200
commit44e58a337a9c314d4542ee6f2acc571aba877ccb (patch)
tree1d071eee1f47d269b68bcac039e90d89e1ada854 /src/declarative/particles
parent3b3a997cfaf24d18202ebda263d04629956738e8 (diff)
Delete scene if you aren't going to use it.
Also make QDeclarativeOpenMetaObjectType zero its engine when the engine dies, because this was leading to problems when the scene wasn't deleted. Also fixes a few other potential deletion problems. Change-Id: I37fa2d1a0b438a6ea7d8cf4c5c9d0bd869faa959 Reviewed-on: http://codereview.qt.nokia.com/2250 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'src/declarative/particles')
-rw-r--r--src/declarative/particles/qsgimageparticle.cpp18
-rw-r--r--src/declarative/particles/qsgmodelparticle.cpp6
-rw-r--r--src/declarative/particles/qsgmodelparticle_p.h1
3 files changed, 20 insertions, 5 deletions
diff --git a/src/declarative/particles/qsgimageparticle.cpp b/src/declarative/particles/qsgimageparticle.cpp
index 8c04175010..e4ba67f6e7 100644
--- a/src/declarative/particles/qsgimageparticle.cpp
+++ b/src/declarative/particles/qsgimageparticle.cpp
@@ -59,7 +59,11 @@ class UltraMaterial : public QSGMaterial
{
public:
UltraMaterial(bool withSprites=false)
- : timestamp(0)
+ : texture(0)
+ , colortable(0)
+ , sizetable(0)
+ , opacitytable(0)
+ , timestamp(0)
, framecount(1)
, animcount(1)
, usesSprites(withSprites)
@@ -69,10 +73,14 @@ public:
~UltraMaterial()
{
- delete texture;
- delete colortable;
- delete sizetable;
- delete opacitytable;
+ if (texture)
+ delete texture;
+ if (colortable)
+ delete colortable;
+ if (sizetable)
+ delete sizetable;
+ if (opacitytable)
+ delete opacitytable;
}
virtual QSGMaterialType *type() const { static QSGMaterialType type; return &type; }
diff --git a/src/declarative/particles/qsgmodelparticle.cpp b/src/declarative/particles/qsgmodelparticle.cpp
index 1d06a96def..08646e32ae 100644
--- a/src/declarative/particles/qsgmodelparticle.cpp
+++ b/src/declarative/particles/qsgmodelparticle.cpp
@@ -68,6 +68,12 @@ QSGModelParticle::QSGModelParticle(QSGItem *parent) :
manageDelegates->start();
}
+QSGModelParticle::~QSGModelParticle()
+{
+ if (m_ownModel)
+ delete m_model;
+}
+
QVariant QSGModelParticle::model() const
{
return m_dataSource;
diff --git a/src/declarative/particles/qsgmodelparticle_p.h b/src/declarative/particles/qsgmodelparticle_p.h
index 5092ddc9cd..c6dd40d51e 100644
--- a/src/declarative/particles/qsgmodelparticle_p.h
+++ b/src/declarative/particles/qsgmodelparticle_p.h
@@ -63,6 +63,7 @@ class QSGModelParticle : public QSGParticlePainter
Q_CLASSINFO("DefaultProperty", "delegate")
public:
explicit QSGModelParticle(QSGItem *parent = 0);
+ virtual ~QSGModelParticle();
QVariant model() const;
void setModel(const QVariant &);