diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-16 01:45:33 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-16 01:49:51 (GMT) |
commit | 84637da766fe1e3a4b4240601a6002f94f1b07c9 (patch) | |
tree | bbd323842d7daa8bf17f0183d455b439a1c092a4 /src/declarative/qml/qmlcontext.cpp | |
parent | befae051c1f80d66f459f375279f36047017c194 (diff) | |
download | Qt-84637da766fe1e3a4b4240601a6002f94f1b07c9.zip Qt-84637da766fe1e3a4b4240601a6002f94f1b07c9.tar.gz Qt-84637da766fe1e3a4b4240601a6002f94f1b07c9.tar.bz2 |
Fix crash on object destruction
Diffstat (limited to 'src/declarative/qml/qmlcontext.cpp')
-rw-r--r-- | src/declarative/qml/qmlcontext.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index b605869..440f4b8 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -86,8 +86,15 @@ void QmlContextPrivate::destroyed(QObject *obj) } } - for (int ii = 0; ii < notifies.count(); ++ii) { - QMetaObject::activate(q, notifies[ii] + notifyIndex, 0); + // There is no need to emit these notifications if our parent is in the + // process of being deleted (which is *probably* why obj has been destroyed + // anyway), as we're about to get deleted which will invalidate all the + // expressions that could depend on us + QObject *parent = q->parent(); + if (!parent || !QObjectPrivate::get(parent)->wasDeleted) { + for (int ii = 0; ii < notifies.count(); ++ii) { + QMetaObject::activate(q, notifies[ii] + notifyIndex, 0); + } } } |