diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-10-17 11:43:35 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-10-18 18:23:13 +0200 |
commit | bcf3f63d52b849d3989f21228f8fb0ce285c3cb2 (patch) | |
tree | f6c59d15de91c4799116d91d9299ff0b1a6e7e57 | |
parent | 80c17af9405ed2e230789868e34e98d9c94fbebf (diff) |
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>
-rw-r--r-- | src/corelib/kernel/qproperty_p.h | 12 | ||||
-rw-r--r-- | src/corelib/kernel/qpropertyprivate.h | 7 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h index 0e1c87f13d..111811134e 100644 --- a/src/corelib/kernel/qproperty_p.h +++ b/src/corelib/kernel/qproperty_p.h @@ -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(); } } diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h index b11d10cd52..d3f384748a 100644 --- a/src/corelib/kernel/qpropertyprivate.h +++ b/src/corelib/kernel/qpropertyprivate.h @@ -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; |