From b1be6e6e6f355bfcb0c3814516f6009c91d2de89 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 25 Nov 2020 13:02:56 +0100 Subject: Remove ExtraBit and FlagMask from QPropertyBindingData They are not needed and removing it can simplify the code in some places and avoid a couple of masking operations. Pick-to: dev 6.0.0 Change-Id: I0e4241a2784026aa89deed35f408b094e89a11a0 Reviewed-by: Fabian Kosmale --- src/corelib/kernel/qproperty.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/corelib/kernel/qproperty.cpp') diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp index ce2e3d0ce1..d6d58bc448 100644 --- a/src/corelib/kernel/qproperty.cpp +++ b/src/corelib/kernel/qproperty.cpp @@ -73,7 +73,8 @@ void QPropertyBindingDataPointer::addObserver(QPropertyObserver *observer) observer->next->prev = &observer->next; binding->firstObserver.ptr = observer; } else { - auto firstObserver = reinterpret_cast(ptr->d_ptr & ~QPropertyBindingData::FlagMask); + Q_ASSERT(!(ptr->d_ptr & QPropertyBindingData::BindingBit)); + auto firstObserver = reinterpret_cast(ptr->d_ptr); observer->prev = reinterpret_cast(&ptr->d_ptr); observer->next = firstObserver; if (observer->next) @@ -249,14 +250,14 @@ QUntypedPropertyBinding QPropertyBindingData::setBinding(const QUntypedPropertyB oldBinding = QPropertyBindingPrivatePtr(existingBinding); observer = static_cast(oldBinding.data())->takeObservers(); static_cast(oldBinding.data())->unlinkAndDeref(); - d_ptr &= FlagMask; + d_ptr = 0; } else { observer = d.firstObserver(); } if (newBinding) { newBinding.data()->addRef(); - d_ptr = (d_ptr & FlagMask) | reinterpret_cast(newBinding.data()); + d_ptr = reinterpret_cast(newBinding.data()); d_ptr |= BindingBit; auto newBindingRaw = static_cast(newBinding.data()); newBindingRaw->setDirty(true); @@ -339,7 +340,7 @@ void QPropertyBindingData::removeBinding() if (auto *existingBinding = d.bindingPtr()) { auto observer = existingBinding->takeObservers(); - d_ptr &= ExtraBit; + d_ptr = 0; if (observer) d.setObservers(observer.ptr); existingBinding->unlinkAndDeref(); -- cgit v1.2.3