summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlpropertycache.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-26 01:36:00 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-26 01:36:00 (GMT)
commit2b0cf3b6a2f1c49f40d6f50b4d24bdd87a4807fa (patch)
tree5054d537a64aedb53761ae5c8f3ee8b8dda1aa1a /src/declarative/qml/qmlpropertycache.cpp
parentcbb1b29d397c063fc3bcae04c5b062f20cbd12c5 (diff)
downloadQt-2b0cf3b6a2f1c49f40d6f50b4d24bdd87a4807fa.zip
Qt-2b0cf3b6a2f1c49f40d6f50b4d24bdd87a4807fa.tar.gz
Qt-2b0cf3b6a2f1c49f40d6f50b4d24bdd87a4807fa.tar.bz2
Ensure cleanup happens before the destruction of QScriptEngine
This was causing crashes on windows.
Diffstat (limited to 'src/declarative/qml/qmlpropertycache.cpp')
-rw-r--r--src/declarative/qml/qmlpropertycache.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp
index e00126f..3ede341 100644
--- a/src/declarative/qml/qmlpropertycache.cpp
+++ b/src/declarative/qml/qmlpropertycache.cpp
@@ -86,12 +86,18 @@ void QmlPropertyCache::Data::load(const QMetaMethod &m)
}
-QmlPropertyCache::QmlPropertyCache()
+QmlPropertyCache::QmlPropertyCache(QmlEngine *engine)
+: QmlCleanup(engine)
{
}
QmlPropertyCache::~QmlPropertyCache()
{
+ clear();
+}
+
+void QmlPropertyCache::clear()
+{
for (int ii = 0; ii < indexCache.count(); ++ii)
indexCache.at(ii)->release();
@@ -102,6 +108,10 @@ QmlPropertyCache::~QmlPropertyCache()
for (IdentifierCache::ConstIterator iter = identifierCache.begin();
iter != identifierCache.end(); ++iter)
(*iter)->release();
+
+ indexCache.clear();
+ stringCache.clear();
+ identifierCache.clear();
}
QmlPropertyCache::Data QmlPropertyCache::create(const QMetaObject *metaObject,
@@ -141,7 +151,7 @@ QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject
Q_ASSERT(engine);
Q_ASSERT(metaObject);
- QmlPropertyCache *cache = new QmlPropertyCache;
+ QmlPropertyCache *cache = new QmlPropertyCache(engine);
QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine);