diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-04-27 09:15:11 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-04 05:51:29 +0200 |
commit | 186abc1e085e4fae7631e329f44e68a810bca38b (patch) | |
tree | ab4ca7211a2a9f788f8790e52579396762ad4213 /src/qml/qml/v8/qv8bindings.cpp | |
parent | 9ae289f259f80458caf7c788ee07357db7e1257a (diff) |
Ensure binding target has not been deleted
Prevent the evaluation of bindings if the target has been deleted.
Also, mark an item as queued for deletion at the beginning of the
destructor call chain, so that bindings triggered by the operation
of the destructor itself are not evaluated (after the context is
destructed, if necessary).
Task-number: QTBUG-25516
Change-Id: I587ef7923eb749eb7980156ad73822c1fb7c1ff3
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/qml/qml/v8/qv8bindings.cpp')
-rw-r--r-- | src/qml/qml/v8/qv8bindings.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/qml/qml/v8/qv8bindings.cpp b/src/qml/qml/v8/qv8bindings.cpp index 65c395e013..7cb14fb8c1 100644 --- a/src/qml/qml/v8/qv8bindings.cpp +++ b/src/qml/qml/v8/qv8bindings.cpp @@ -106,6 +106,14 @@ void QV8Bindings::Binding::update(QQmlPropertyPrivate::WriteFlags flags) if (!enabledFlag()) return; + QQmlContextData *context = parent->context(); + if (!context || !context->isValid()) + return; + + // Check that the target has not been deleted + if (QQmlData::wasDeleted(object())) + return; + QQmlTrace trace("V8 Binding Update"); trace.addDetail("URL", parent->url()); trace.addDetail("Line", instruction->line); @@ -113,12 +121,9 @@ void QV8Bindings::Binding::update(QQmlPropertyPrivate::WriteFlags flags) QQmlBindingProfiler prof(parent->urlString(), instruction->line, instruction->column); - QQmlContextData *context = parent->context(); - if (!context || !context->isValid()) - return; - if (!updatingFlag()) { setUpdatingFlag(true); + QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context->engine); bool isUndefined = false; |