QProperty: Eliminate further unnecessary TLS operations

If we don't have a binding, we don't need to remove it. We can figure
this out without TLS lookup.

Pick-to: 6.2
Change-Id: I0cb20f2a68a119df7742631e307002e3813eac03
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Ulf Hermann 2021-10-17 11:43:35 +02:00
parent 80c17af940
commit bcf3f63d52
2 changed files with 13 additions and 6 deletions

View File

@ -456,8 +456,8 @@ public:
{
const QBindingStorage *storage = qGetBindingStorage(owner());
// make sure we don't register this binding as a dependency to itself
if (!inBindingWrapper(storage))
storage->registerDependency(this);
if (storage->bindingStatus->currentlyEvaluatingBinding && !inBindingWrapper(storage))
storage->registerDependency_helper(this);
return this->val;
}
@ -488,8 +488,8 @@ public:
QBindingStorage *storage = qGetBindingStorage(owner());
if (auto *bd = storage->bindingData(this)) {
// make sure we don't remove the binding if called from the bindingWrapper
if (!inBindingWrapper(storage))
bd->removeBinding();
if (bd->hasBinding() && !inBindingWrapper(storage))
bd->removeBinding_helper();
}
this->val = t;
}
@ -539,8 +539,8 @@ public:
QBindingStorage *storage = qGetBindingStorage(owner());
if (auto *bd = storage->bindingData(this)) {
// make sure we don't remove the binding if called from the bindingWrapper
if (!inBindingWrapper(storage))
bd->removeBinding();
if (bd->hasBinding() && !inBindingWrapper(storage))
bd->removeBinding_helper();
}
}

View File

@ -61,6 +61,9 @@ QT_BEGIN_NAMESPACE
class QBindingStorage;
template<typename Class, typename T, auto Offset, auto Setter, auto Signal>
class QObjectCompatProperty;
namespace QtPrivate {
// QPropertyBindingPrivatePtr operates on a RefCountingMixin solely so that we can inline
// the constructor and copy constructor
@ -259,6 +262,10 @@ class Q_CORE_EXPORT QPropertyBindingData
friend struct QT_PREPEND_NAMESPACE(QPropertyBindingDataPointer);
friend class QT_PREPEND_NAMESPACE(QQmlPropertyBinding);
friend struct QT_PREPEND_NAMESPACE(QPropertyDelayedNotifications);
template<typename Class, typename T, auto Offset, auto Setter, auto Signal>
friend class QT_PREPEND_NAMESPACE(QObjectCompatProperty);
Q_DISABLE_COPY(QPropertyBindingData)
public:
QPropertyBindingData() = default;