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>
This commit is contained in:
parent
44b7a1a37b
commit
80c17af940
@ -486,11 +486,11 @@ public:
|
||||
void setValue(parameter_type t)
|
||||
{
|
||||
QBindingStorage *storage = qGetBindingStorage(owner());
|
||||
auto *bd = storage->bindingData(this);
|
||||
if (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)
|
||||
if (!inBindingWrapper(storage))
|
||||
bd->removeBinding();
|
||||
}
|
||||
this->val = t;
|
||||
}
|
||||
|
||||
@ -537,20 +537,20 @@ public:
|
||||
void removeBindingUnlessInWrapper()
|
||||
{
|
||||
QBindingStorage *storage = qGetBindingStorage(owner());
|
||||
auto *bd = storage->bindingData(this);
|
||||
if (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)
|
||||
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)
|
||||
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());
|
||||
|
Loading…
Reference in New Issue
Block a user