summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-10-16 11:30:50 +0200
committerUlf Hermann <ulf.hermann@qt.io>2021-10-18 18:23:13 +0200
commit80c17af9405ed2e230789868e34e98d9c94fbebf (patch)
treed3f7cdbc7065dd9ed17e7c54d79eb8d2c86aef61 /src/corelib
parent44b7a1a37b18defcf27cee4fb5f6f8695387965d (diff)
QProperty: Don't needlessly calculate inBindingWrapper()
If there is no binding data, we don't need it. inBindingWrapper() involves a TLS lookup. Pick-to: 6.2 Change-Id: I829f314d708b80821e907124eef4aec758bbbc6a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qproperty_p.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h
index 742ef446ca..0e1c87f13d 100644
--- a/src/corelib/kernel/qproperty_p.h
+++ b/src/corelib/kernel/qproperty_p.h
@@ -486,11 +486,11 @@ public:
void setValue(parameter_type t)
{
QBindingStorage *storage = qGetBindingStorage(owner());
- auto *bd = storage->bindingData(this);
- // make sure we don't remove the binding if called from the bindingWrapper
- const bool inWrapper = inBindingWrapper(storage);
- if (bd && !inWrapper)
- bd->removeBinding();
+ if (auto *bd = storage->bindingData(this)) {
+ // make sure we don't remove the binding if called from the bindingWrapper
+ if (!inBindingWrapper(storage))
+ bd->removeBinding();
+ }
this->val = t;
}
@@ -537,20 +537,20 @@ public:
void removeBindingUnlessInWrapper()
{
QBindingStorage *storage = qGetBindingStorage(owner());
- auto *bd = storage->bindingData(this);
- // make sure we don't remove the binding if called from the bindingWrapper
- const bool inWrapper = inBindingWrapper(storage);
- if (bd && !inWrapper)
- bd->removeBinding();
+ if (auto *bd = storage->bindingData(this)) {
+ // make sure we don't remove the binding if called from the bindingWrapper
+ if (!inBindingWrapper(storage))
+ bd->removeBinding();
+ }
}
void notify()
{
QBindingStorage *storage = qGetBindingStorage(owner());
- auto bd = storage->bindingData(this, false);
- const bool inWrapper = inBindingWrapper(storage);
- if (bd && !inWrapper)
- notify(bd);
+ if (auto bd = storage->bindingData(this, false)) {
+ if (!inBindingWrapper(storage))
+ notify(bd);
+ }
if constexpr (!std::is_null_pointer_v<decltype(Signal)>) {
if constexpr (SignalTakesValue::value)
(owner()->*Signal)(value());