summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qproperty.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-11-26 14:13:43 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-11-30 23:02:30 +0000
commitd555425ff8503a793d9d42372ce78fa0530a670d (patch)
tree52b4fc4ff073fcd4cd2d82cca186e47cc0fd4c49 /src/corelib/kernel/qproperty.cpp
parente095bebaf5f3a437c72f02a5d8c63ae88e15a394 (diff)
Inline the fast path for removeBinding()
Save a function call in the common case where we don't have a binding This makes a rather large performance difference for setters that do not have a binding. Change-Id: I140f29790f6fe868721a33b9fad37205e547b8e9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit c63901c5f3195596eb81e5f5ae5483ca5a0b6d35) Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/kernel/qproperty.cpp')
-rw-r--r--src/corelib/kernel/qproperty.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp
index a93fcdad03..70bed15c23 100644
--- a/src/corelib/kernel/qproperty.cpp
+++ b/src/corelib/kernel/qproperty.cpp
@@ -328,17 +328,18 @@ void QPropertyBindingData::evaluateIfDirty(const QUntypedPropertyData *property)
binding->evaluateIfDirtyAndReturnTrueIfValueChanged(property);
}
-void QPropertyBindingData::removeBinding()
+void QPropertyBindingData::removeBinding_helper()
{
QPropertyBindingDataPointer d{this};
- if (auto *existingBinding = d.bindingPtr()) {
- auto observer = existingBinding->takeObservers();
- d_ptr = 0;
- if (observer)
- d.setObservers(observer.ptr);
- existingBinding->unlinkAndDeref();
- }
+ auto *existingBinding = d.bindingPtr();
+ Q_ASSERT(existingBinding);
+
+ auto observer = existingBinding->takeObservers();
+ d_ptr = 0;
+ if (observer)
+ d.setObservers(observer.ptr);
+ existingBinding->unlinkAndDeref();
}
void QPropertyBindingData::registerWithCurrentlyEvaluatingBinding() const