diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-01-22 05:37:39 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-01-22 08:01:48 (GMT) |
commit | 3a75eeb5da34fbb50173c3f610c08d160c21f4e3 (patch) | |
tree | ab854f509d3a3720b74d2ef9d5e7803881078673 /src/declarative/qml/qmlbinding.cpp | |
parent | 0fe084df052b8ac66918d0b2732b65f5569881c0 (diff) | |
download | Qt-3a75eeb5da34fbb50173c3f610c08d160c21f4e3.zip Qt-3a75eeb5da34fbb50173c3f610c08d160c21f4e3.tar.gz Qt-3a75eeb5da34fbb50173c3f610c08d160c21f4e3.tar.bz2 |
Harden QML binding optimizer
Diffstat (limited to 'src/declarative/qml/qmlbinding.cpp')
-rw-r--r-- | src/declarative/qml/qmlbinding.cpp | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp index 4ec7191..c0389a8 100644 --- a/src/declarative/qml/qmlbinding.cpp +++ b/src/declarative/qml/qmlbinding.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE QML_DEFINE_NOCREATE_TYPE(QmlBinding); QmlBindingData::QmlBindingData() -: updating(false), enabled(false), nextError(0), prevError(0) +: updating(false), enabled(false) { } @@ -78,37 +78,6 @@ void QmlBindingData::refresh() } } -void QmlBindingData::removeError() -{ - if (!prevError) return; - - if (nextError) nextError->prevError = prevError; - *prevError = nextError; - nextError = 0; - prevError = 0; -} - -bool QmlBindingData::addError() -{ - if (prevError) return false; - - QmlContext *c = context(); - if (!c) return false; - QmlEngine *e = c->engine(); - if (!e) return false; - - QmlEnginePrivate *p = QmlEnginePrivate::get(e); - - if (p->inProgressCreations == 0) return false; // Not in construction - - prevError = &p->erroredBindings; - nextError = p->erroredBindings; - p->erroredBindings = this; - if (nextError) nextError->prevError = &nextError; - - return true; -} - QmlBindingPrivate::QmlBindingPrivate() : QmlExpressionPrivate(new QmlBindingData) { @@ -210,7 +179,9 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags) } if (data->error.isValid()) { - if (!data->addError()) + QmlEnginePrivate *p = (data->context() && data->context()->engine())? + QmlEnginePrivate::get(data->context()->engine()):0; + if (!data->addError(p)) qWarning().nospace() << qPrintable(this->error().toString()); } else { data->removeError(); |