diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-14 06:16:07 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-14 06:16:59 (GMT) |
commit | e52a73d8c74576e267dcc59d42247bd14131daaf (patch) | |
tree | f23bd7a9cc5d6163a9807f43237c21c7f644fe50 /src | |
parent | 5a8b5b892441a65319e39c1a8f305cf0b49edf17 (diff) | |
download | Qt-e52a73d8c74576e267dcc59d42247bd14131daaf.zip Qt-e52a73d8c74576e267dcc59d42247bd14131daaf.tar.gz Qt-e52a73d8c74576e267dcc59d42247bd14131daaf.tar.bz2 |
Reduce warnings at shutdown
QTBUG-9799
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qdeclarativebinding.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativecompiledbindings.cpp | 5 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativecontext_p.h | 4 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 6 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeexpression.cpp | 2 |
5 files changed, 10 insertions, 9 deletions
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index e172a8b..664118d 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -126,7 +126,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) QDeclarativeBindingData *data = d->bindingData(); - if (!data->enabled || !data->context() || !data->context()->engine) + if (!data->enabled || !data->context() || !data->context()->isValid()) return; data->addref(); diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index bbce8a6..6fdf706 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -285,10 +285,7 @@ void QDeclarativeCompiledBindingsPrivate::run(Binding *binding, QDeclarativeProp return; QDeclarativeContextData *context = q->QDeclarativeAbstractExpression::context(); - if (!context) - return; - - if (!context->engine) + if (!context || !context->isValid()) return; if (binding->updating) { diff --git a/src/declarative/qml/qdeclarativecontext_p.h b/src/declarative/qml/qdeclarativecontext_p.h index eee72b6..6059f72 100644 --- a/src/declarative/qml/qdeclarativecontext_p.h +++ b/src/declarative/qml/qdeclarativecontext_p.h @@ -114,6 +114,10 @@ public: QDeclarativeContextData(QDeclarativeContext *); void destroy(); + inline bool isValid() const { + return engine && (!isInternal || contextObject && !QObjectPrivate::get(contextObject)->wasDeleted); + } + // My parent context and engine QDeclarativeContextData *parent; QDeclarativeEngine *engine; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 8462c65..f621af5 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -851,6 +851,9 @@ void QDeclarativeDeclarativeData::destroyed(QObject *object) if (propertyCache) propertyCache->release(); + if (ownContext) + context->destroy(); + QDeclarativeGuard<QObject> *guard = guards; while (guard) { QDeclarativeGuard<QObject> *g = guard; @@ -861,9 +864,6 @@ void QDeclarativeDeclarativeData::destroyed(QObject *object) g->objectDestroyed(object); } - if (ownContext) - context->destroy(); - if (scriptValue) delete scriptValue; diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index 2a3e557..05240a2 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -468,7 +468,7 @@ QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isU { Q_Q(QDeclarativeExpression); - if (!q->engine()) { + if (!data || !data->context() || !data->context()->isValid()) { qWarning("QDeclarativeExpression: Attempted to evaluate an expression in an invalid context"); return QVariant(); } |