summaryrefslogtreecommitdiffstats
path: root/src/declarative/util/qmllistmodel.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-09-09 04:43:26 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-09-09 04:43:26 (GMT)
commited8e89eaddca1c508151ef5913f0d383d3071b99 (patch)
treea95ef4714afecab93c0ee21ff3fb8769ae4195bd /src/declarative/util/qmllistmodel.cpp
parent5ad67ddc40263cabd3fd99fb57c8f095403bcbbe (diff)
downloadQt-ed8e89eaddca1c508151ef5913f0d383d3071b99.zip
Qt-ed8e89eaddca1c508151ef5913f0d383d3071b99.tar.gz
Qt-ed8e89eaddca1c508151ef5913f0d383d3071b99.tar.bz2
Fix destruction of ModelNodes (fix crash-on-exit).
Diffstat (limited to 'src/declarative/util/qmllistmodel.cpp')
-rw-r--r--src/declarative/util/qmllistmodel.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 82942f6..8e5ea9c 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -200,7 +200,7 @@ class ModelObject : public QObject
{
Q_OBJECT
public:
- ModelObject(ModelNode *);
+ ModelObject();
void setValue(const QByteArray &name, const QVariant &val)
{
@@ -208,8 +208,6 @@ public:
}
private:
- ModelNode *_node;
- bool _haveProperties;
QmlOpenMetaObject *_mo;
};
@@ -231,7 +229,7 @@ struct ModelNode
ModelObject *object() {
if (!objectCache) {
- objectCache = new ModelObject(this);
+ objectCache = new ModelObject();
QHash<QString, ModelNode *>::iterator it;
for (it = properties.begin(); it != properties.end(); ++it) {
if (!(*it)->values.isEmpty())
@@ -294,8 +292,8 @@ struct ModelNode
ModelObject *objectCache;
};
-ModelObject::ModelObject(ModelNode *node)
-: _node(node), _haveProperties(false), _mo(new QmlOpenMetaObject(this))
+ModelObject::ModelObject()
+: _mo(new QmlOpenMetaObject(this))
{
}
@@ -841,7 +839,8 @@ ModelNode::~ModelNode()
ModelNode *node = qvariant_cast<ModelNode *>(values.at(ii));
if (node) { delete node; node = 0; }
}
- if (modelCache) { delete modelCache; modelCache = 0; }
+ if (modelCache) { modelCache->_root = 0/* ==this */; delete modelCache; modelCache = 0; }
+ if (objectCache) { delete objectCache; }
}
QT_END_NAMESPACE