diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp index a10279df85e..8b14390bc6e 100644 --- a/src/corelib/kernel/qproperty.cpp +++ b/src/corelib/kernel/qproperty.cpp @@ -161,7 +161,7 @@ struct QPropertyDelayedNotifications delayed->d_ptr = 0; if (observer) - observer.notify(delayed->propertyData); + observer.notify(delayed->propertyData); } }; @@ -286,22 +286,6 @@ bool QPropertyBindingPrivate::evaluateRecursive(PendingBindingObserverList &bind return evaluateRecursive_inline(bindingObservers, status); } -void QPropertyBindingPrivate::notifyRecursive() -{ - if (!pendingNotify) - return; - pendingNotify = false; - Q_ASSERT(!updating); - updating = true; - if (firstObserver) { - firstObserver.noSelfDependencies(this); - firstObserver.notify(propertyDataPtr); - } - if (hasStaticObserver) - staticObserverCallback(propertyDataPtr); - updating = false; -} - void QPropertyBindingPrivate::notifyNonRecursive(const PendingBindingObserverList &bindingObservers) { notifyNonRecursive(); @@ -319,7 +303,7 @@ QPropertyBindingPrivate::NotificationState QPropertyBindingPrivate::notifyNonRec updating = true; if (firstObserver) { firstObserver.noSelfDependencies(this); - firstObserver.notifyOnlyChangeHandler(propertyDataPtr); + firstObserver.notify(propertyDataPtr); } if (hasStaticObserver) staticObserverCallback(propertyDataPtr); @@ -606,7 +590,7 @@ void QPropertyBindingData::notifyObservers(QUntypedPropertyData *propertyDataPtr if (notifyObserver_helper(propertyDataPtr, storage, observer, bindingObservers) == Evaluated) { // evaluateBindings() can trash the observers. We need to re-fetch here. if (QPropertyObserverPointer observer = d.firstObserver()) - observer.notifyOnlyChangeHandler(propertyDataPtr); + observer.notify(propertyDataPtr); for (auto &&bindingObserver: bindingObservers) bindingObserver.binding()->notifyNonRecursive(); } diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h index 3ae1bfcc23b..dbf5535143e 100644 --- a/src/corelib/kernel/qproperty_p.h +++ b/src/corelib/kernel/qproperty_p.h @@ -144,9 +144,7 @@ struct QPropertyObserverPointer enum class Notify {Everything, OnlyChangeHandlers}; - template void notify(QUntypedPropertyData *propertyDataPtr); - void notifyOnlyChangeHandler(QUntypedPropertyData *propertyDataPtr); #ifndef QT_NO_DEBUG void noSelfDependencies(QPropertyBindingPrivate *binding); #else @@ -371,7 +369,6 @@ public: bool Q_ALWAYS_INLINE evaluateRecursive_inline(PendingBindingObserverList &bindingObservers, QBindingStatus *status); - void notifyRecursive(); void notifyNonRecursive(const PendingBindingObserverList &bindingObservers); enum NotificationState : bool { Delayed, Sent }; NotificationState notifyNonRecursive(); @@ -632,7 +629,7 @@ public: == QtPrivate::QPropertyBindingData::Evaluated) { // evaluateBindings() can trash the observers. We need to re-fetch here. if (QPropertyObserverPointer observer = d.firstObserver()) - observer.notifyOnlyChangeHandler(this); + observer.notify(this); for (auto&& bindingObserver: bindingObservers) bindingObserver.binding()->notifyNonRecursive(); } @@ -834,7 +831,14 @@ inline bool QPropertyBindingPrivate::evaluateRecursive_inline(PendingBindingObse return true; } -template +/*! + \internal + + Walks through the list of property observers, and calls any ChangeHandler + found there. + It doesn't do anything with bindings, which are only handled in + QPropertyBindingPrivate::evaluateRecursive. + */ inline void QPropertyObserverPointer::notify(QUntypedPropertyData *propertyDataPtr) { auto observer = const_cast(ptr); @@ -873,15 +877,7 @@ inline void QPropertyObserverPointer::notify(QUntypedPropertyData *propertyDataP break; } case QPropertyObserver::ObserverNotifiesBinding: - { - if constexpr (notifyPolicy == Notify::Everything) { - auto bindingToNotify = observer->binding; - QPropertyObserverNodeProtector protector(observer); - bindingToNotify->notifyRecursive(); - next = protector.next(); - } break; - } case QPropertyObserver::ObserverIsPlaceholder: // recursion is already properly handled somewhere else break; @@ -895,11 +891,6 @@ inline void QPropertyObserverPointer::notify(QUntypedPropertyData *propertyDataP } } -inline void QPropertyObserverPointer::notifyOnlyChangeHandler(QUntypedPropertyData *propertyDataPtr) -{ - notify(propertyDataPtr); -} - inline QPropertyObserverNodeProtector::~QPropertyObserverNodeProtector() { QPropertyObserverPointer d{static_cast(&m_placeHolder)};