summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qproperty.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-11-25 13:02:56 +0100
committerLars Knoll <lars.knoll@qt.io>2020-11-26 21:40:02 +0100
commitb1be6e6e6f355bfcb0c3814516f6009c91d2de89 (patch)
tree5adeeaaeb1c5acafd61b5a8a0787f5e1c62f32cb /src/corelib/kernel/qproperty.cpp
parenteda4c29eb26dab32e22040bdda0b9b9109b1408b (diff)
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 <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qproperty.cpp')
-rw-r--r--src/corelib/kernel/qproperty.cpp9
1 files changed, 5 insertions, 4 deletions
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<QPropertyObserver*>(ptr->d_ptr & ~QPropertyBindingData::FlagMask);
+ Q_ASSERT(!(ptr->d_ptr & QPropertyBindingData::BindingBit));
+ auto firstObserver = reinterpret_cast<QPropertyObserver*>(ptr->d_ptr);
observer->prev = reinterpret_cast<QPropertyObserver**>(&ptr->d_ptr);
observer->next = firstObserver;
if (observer->next)
@@ -249,14 +250,14 @@ QUntypedPropertyBinding QPropertyBindingData::setBinding(const QUntypedPropertyB
oldBinding = QPropertyBindingPrivatePtr(existingBinding);
observer = static_cast<QPropertyBindingPrivate *>(oldBinding.data())->takeObservers();
static_cast<QPropertyBindingPrivate *>(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<quintptr>(newBinding.data());
+ d_ptr = reinterpret_cast<quintptr>(newBinding.data());
d_ptr |= BindingBit;
auto newBindingRaw = static_cast<QPropertyBindingPrivate *>(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();