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 +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 + friend class QT_PREPEND_NAMESPACE(QObjectCompatProperty); + Q_DISABLE_COPY(QPropertyBindingData) public: QPropertyBindingData() = default;