diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-11 01:36:57 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-11 01:36:57 (GMT) |
commit | 738fe5730a55279bf3c033bad7317768d81f40af (patch) | |
tree | 1b1c8df3ed26aa338008df672529d0aa228c93a0 /src/declarative/qml/qmlengine.cpp | |
parent | ac19c9a30a47bfe8b374d390525b06ebdb26b4ca (diff) | |
download | Qt-738fe5730a55279bf3c033bad7317768d81f40af.zip Qt-738fe5730a55279bf3c033bad7317768d81f40af.tar.gz Qt-738fe5730a55279bf3c033bad7317768d81f40af.tar.bz2 |
Handle QmlParserStatus's and QmlBindableValeus being deleted during component creation
Diffstat (limited to 'src/declarative/qml/qmlengine.cpp')
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 50c0981..f0ec334 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -70,6 +70,7 @@ #include <QtCore/qdir.h> #include <qmlcomponent.h> #include "private/qmlmetaproperty_p.h" +#include <private/qmlbindablevalue_p.h> QT_BEGIN_NAMESPACE @@ -160,6 +161,34 @@ QmlEnginePrivate::~QmlEnginePrivate() objectClass = 0; delete networkAccessManager; networkAccessManager = 0; + + for(int ii = 0; ii < bindValues.count(); ++ii) + clear(bindValues[ii]); + for(int ii = 0; ii < parserStatus.count(); ++ii) + clear(parserStatus[ii]); +} + +void QmlEnginePrivate::clear(SimpleList<QmlBindableValue> &bvs) +{ + for (int ii = 0; ii < bvs.count; ++ii) { + QmlBindableValue *bv = bvs.at(ii); + if(bv) { + QmlBindableValuePrivate *p = + static_cast<QmlBindableValuePrivate *>(QObjectPrivate::get(bv)); + p->mePtr = 0; + } + } + bvs.clear(); +} + +void QmlEnginePrivate::clear(SimpleList<QmlParserStatus> &pss) +{ + for (int ii = 0; ii < pss.count; ++ii) { + QmlParserStatus *ps = pss.at(ii); + if(ps) + ps->d = 0; + } + pss.clear(); } void QmlEnginePrivate::init() |