summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeengine.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-15 06:35:51 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-15 06:35:51 (GMT)
commit30a3e78a12b72ab6f67992ec2f06cd4f21a01a6c (patch)
treebb480e0a908016f24a4e57755b2265ebf5b5ea16 /src/declarative/qml/qdeclarativeengine.cpp
parent6362d17d5551749618f5975e050c54fca31c408f (diff)
downloadQt-30a3e78a12b72ab6f67992ec2f06cd4f21a01a6c.zip
Qt-30a3e78a12b72ab6f67992ec2f06cd4f21a01a6c.tar.gz
Qt-30a3e78a12b72ab6f67992ec2f06cd4f21a01a6c.tar.bz2
Add Component.onDestruction attached property
This property complements Component.onCompleted. It is emitted before the destruction actually begins (for the most part) so the objects are still alive and accessible. The QtObject.onDestroyed signal is now blocked as it never really worked properly anyway.
Diffstat (limited to 'src/declarative/qml/qdeclarativeengine.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index a478bf5..1deadb2 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -155,7 +155,7 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e)
: captureProperties(false), rootContext(0), currentExpression(0), isDebugging(false),
contextClass(0), sharedContext(0), sharedScope(0), objectClass(0), valueTypeClass(0),
globalClass(0), cleanup(0), erroredBindings(0), inProgressCreations(0),
- scriptEngine(this), workerScriptEngine(0), componentAttacheds(0), inBeginCreate(false),
+ scriptEngine(this), workerScriptEngine(0), componentAttached(0), inBeginCreate(false),
networkAccessManager(0), networkAccessManagerFactory(0),
typeManager(e), uniqueId(1)
{
@@ -350,8 +350,13 @@ typedef QMap<QString, QString> StringStringMap;
Q_GLOBAL_STATIC(StringStringMap, qmlEnginePluginsWithRegisteredTypes); // stores the uri
-void QDeclarativePrivate::qdeclarativeelement_destructor(QObject *)
+void QDeclarativePrivate::qdeclarativeelement_destructor(QObject *o)
{
+ QObjectPrivate *p = QObjectPrivate::get(o);
+ Q_ASSERT(p->declarativeData);
+ QDeclarativeData *d = static_cast<QDeclarativeData*>(p->declarativeData);
+ if (d->ownContext)
+ d->context->destroy();
}
void QDeclarativeData::destroyed(QAbstractDeclarativeData *d, QObject *o)
@@ -855,7 +860,7 @@ void QDeclarativeData::destroyed(QObject *object)
if (propertyCache)
propertyCache->release();
- if (ownContext)
+ if (ownContext && context)
context->destroy();
QDeclarativeGuard<QObject> *guard = guards;