aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlbinding.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-04-16 14:01:07 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-27 07:45:02 +0000
commiteef0584248b35258cba472c3b878a100b490b562 (patch)
treed0faee84a97f4479aa3a6d1b3f00f17faef5e107 /src/qml/qml/qqmlbinding.cpp
parent80defcb0c01d747f331719c0f89992d6db660f98 (diff)
Minor cleanup
Change-Id: I10abb08d80abc210986b2a7f820b8118b38485dc Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/qqmlbinding.cpp')
-rw-r--r--src/qml/qml/qqmlbinding.cpp67
1 files changed, 34 insertions, 33 deletions
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 0e56a67cf7..d691e67a1e 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -170,56 +170,57 @@ void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags)
QV4::ScopedFunctionObject f(scope, m_function.value());
Q_ASSERT(f);
- if (!updatingFlag()) {
- QQmlBindingProfiler prof(ep->profiler, f);
- setUpdatingFlag(true);
+ if (updatingFlag()) {
+ QQmlProperty p = QQmlPropertyPrivate::restore(targetObject(), m_core, 0);
+ QQmlAbstractBinding::printBindingLoopError(p);
+ return;
+ }
- QQmlJavaScriptExpression::DeleteWatcher watcher(this);
+ QQmlBindingProfiler prof(ep->profiler, f);
+ setUpdatingFlag(true);
- if (m_core.propType == qMetaTypeId<QQmlBinding *>()) {
+ QQmlJavaScriptExpression::DeleteWatcher watcher(this);
- int idx = m_core.coreIndex;
- Q_ASSERT(idx != -1);
+ if (m_core.propType == qMetaTypeId<QQmlBinding *>()) {
- QQmlBinding *t = this;
- int status = -1;
- void *a[] = { &t, 0, &status, &flags };
- QMetaObject::metacall(m_coreObject, QMetaObject::WriteProperty, idx, a);
+ int idx = m_core.coreIndex;
+ Q_ASSERT(idx != -1);
- } else {
- ep->referenceScarceResources();
+ QQmlBinding *t = this;
+ int status = -1;
+ void *a[] = { &t, 0, &status, &flags };
+ QMetaObject::metacall(m_coreObject, QMetaObject::WriteProperty, idx, a);
- bool isUndefined = false;
+ } else {
+ ep->referenceScarceResources();
- QV4::ScopedValue result(scope, QQmlJavaScriptExpression::evaluate(&isUndefined));
+ bool isUndefined = false;
- bool needsErrorLocationData = false;
- if (!watcher.wasDeleted() && !hasError())
- needsErrorLocationData = !QQmlPropertyPrivate::writeBinding(m_coreObject, m_core, context(),
- this, result, isUndefined, flags);
+ QV4::ScopedValue result(scope, QQmlJavaScriptExpression::evaluate(&isUndefined));
- if (!watcher.wasDeleted()) {
+ bool needsErrorLocationData = false;
+ if (!watcher.wasDeleted() && !hasError())
+ needsErrorLocationData = !QQmlPropertyPrivate::writeBinding(m_coreObject, m_core, context(),
+ this, result, isUndefined, flags);
- if (needsErrorLocationData)
- delayedError()->setErrorLocation(f->sourceLocation());
+ if (!watcher.wasDeleted()) {
- if (hasError()) {
- if (!delayedError()->addError(ep)) ep->warning(this->error(context()->engine));
- } else {
- clearError();
- }
+ if (needsErrorLocationData)
+ delayedError()->setErrorLocation(f->sourceLocation());
+ if (hasError()) {
+ if (!delayedError()->addError(ep)) ep->warning(this->error(context()->engine));
+ } else {
+ clearError();
}
- ep->dereferenceScarceResources();
}
- if (!watcher.wasDeleted())
- setUpdatingFlag(false);
- } else {
- QQmlProperty p = QQmlPropertyPrivate::restore(targetObject(), m_core, 0);
- QQmlAbstractBinding::printBindingLoopError(p);
+ ep->dereferenceScarceResources();
}
+
+ if (!watcher.wasDeleted())
+ setUpdatingFlag(false);
}
QVariant QQmlBinding::evaluate()