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
committerFabian Kosmale <fabian.kosmale@qt.io>2020-11-30 23:02:29 +0000
commit76743374e75df72311f25349b1274256eaddfc75 (patch)
tree69c98fb1a111c6e42c62e2d09465d0acdb5afba2 /src/corelib/kernel/qproperty.cpp
parentf538ce920ec94e07124ebc77f01a00706aa8f4ae (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. Change-Id: I0e4241a2784026aa89deed35f408b094e89a11a0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit b1be6e6e6f355bfcb0c3814516f6009c91d2de89) Reviewed-by: Ulf Hermann <ulf.hermann@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();