aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvaluetypeproxybinding.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2012-05-23 11:38:46 +0100
committerQt by Nokia <qt-info@nokia.com>2012-05-24 17:50:07 +0200
commit6ff8aa4b83e801acadd45cc32759ea77cf4532c8 (patch)
tree564c6585f8ce46321709069708be7d77f17c3779 /src/qml/qml/qqmlvaluetypeproxybinding.cpp
parent72ac68162e4ab94bb2b62e047a726c119f77df13 (diff)
Reduce size of QQmlAbstractBinding
The doubly-linked list is unnecessary. Most bindings are created at startup, and removed only when the object is destroyed. In these cases the double-link buys nothing other than wasted space. Even when the bindings are removed earlier, searching the list is not that slow. Change-Id: I22e1376b78ba712dafd171c7447fbc6ed212b891 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlvaluetypeproxybinding.cpp')
-rw-r--r--src/qml/qml/qqmlvaluetypeproxybinding.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlvaluetypeproxybinding.cpp b/src/qml/qml/qqmlvaluetypeproxybinding.cpp
index 2cc15a50f5..2b891dc4e1 100644
--- a/src/qml/qml/qqmlvaluetypeproxybinding.cpp
+++ b/src/qml/qml/qqmlvaluetypeproxybinding.cpp
@@ -50,10 +50,14 @@ QQmlValueTypeProxyBinding::QQmlValueTypeProxyBinding(QObject *o, int index)
QQmlValueTypeProxyBinding::~QQmlValueTypeProxyBinding()
{
- while (m_bindings) {
- QQmlAbstractBinding *binding = m_bindings;
- binding->setEnabled(false, 0);
+ QQmlAbstractBinding *binding = m_bindings;
+ // This must be identical to the logic in QQmlData::destroyed()
+ while (binding) {
+ QQmlAbstractBinding *next = binding->m_nextBinding;
+ binding->setAddedToObject(false);
+ binding->m_nextBinding = 0;
binding->destroy();
+ binding = next;
}
}
@@ -110,16 +114,23 @@ Removes a collection of bindings, corresponding to the set bits in \a mask.
void QQmlValueTypeProxyBinding::removeBindings(quint32 mask)
{
QQmlAbstractBinding *binding = m_bindings;
+ QQmlAbstractBinding *lastBinding = 0;
+
while (binding) {
if (mask & (1 << (binding->propertyIndex() >> 24))) {
QQmlAbstractBinding *remove = binding;
binding = remove->m_nextBinding;
- *remove->m_prevBinding = remove->m_nextBinding;
- if (remove->m_nextBinding) remove->m_nextBinding->m_prevBinding = remove->m_prevBinding;
- remove->m_prevBinding = 0;
+
+ if (lastBinding == 0)
+ m_bindings = remove->m_nextBinding;
+ else
+ lastBinding->m_nextBinding = remove->m_nextBinding;
+
+ remove->setAddedToObject(false);
remove->m_nextBinding = 0;
remove->destroy();
} else {
+ lastBinding = binding;
binding = binding->m_nextBinding;
}
}