summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-04-16 08:30:18 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2020-04-17 11:24:10 +0200
commit4857f0ebd7f4ea422f7a5dc721f0204390adddbb (patch)
tree7d1bed0dbaacb9475cb9714f791bee1bd67e51af
parent6ce4c7d002b6b0ba77416c3b924acdcc4414c0da (diff)
Make it possible to take bindings from properties without private headers
Passing the QExplicitlySharedDataPointer by reference may lead compilers to wanting to have visibility to the destructor of the contained type (QPropertyBindingPrivate), which is not public. Fortunately QExplicitlySharedDataPointer is safe to use with raw pointers and those can be safely forward declared. Change-Id: I131ab6363eaee10b6dce196fb2c769e09a5c9557 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--src/corelib/kernel/qproperty.cpp10
-rw-r--r--src/corelib/kernel/qproperty.h2
-rw-r--r--src/corelib/kernel/qpropertybinding.cpp2
-rw-r--r--src/corelib/kernel/qpropertyprivate.h2
4 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp
index 0e51226b34..e249dcfb44 100644
--- a/src/corelib/kernel/qproperty.cpp
+++ b/src/corelib/kernel/qproperty.cpp
@@ -102,7 +102,7 @@ QUntypedPropertyBinding QPropertyBase::setBinding(const QUntypedPropertyBinding
if (auto *existingBinding = d.bindingPtr()) {
if (existingBinding == newBinding.data())
- return QUntypedPropertyBinding(oldBinding);
+ return QUntypedPropertyBinding(oldBinding.data());
oldBinding = QPropertyBindingPrivatePtr(existingBinding);
oldBinding->unlinkAndDeref();
d_ptr &= FlagMask;
@@ -119,15 +119,15 @@ QUntypedPropertyBinding QPropertyBase::setBinding(const QUntypedPropertyBinding
d_ptr &= ~BindingBit;
}
- return QUntypedPropertyBinding(oldBinding);
+ return QUntypedPropertyBinding(oldBinding.data());
}
-QPropertyBindingPrivatePtr QPropertyBase::binding()
+QPropertyBindingPrivate *QPropertyBase::binding()
{
QPropertyBasePointer d{this};
if (auto binding = d.bindingPtr())
- return QPropertyBindingPrivatePtr(binding);
- return QPropertyBindingPrivatePtr();
+ return binding;
+ return nullptr;
}
QPropertyBindingPrivate *QPropertyBasePointer::bindingPtr() const
diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h
index 609bb85221..8f050327d5 100644
--- a/src/corelib/kernel/qproperty.h
+++ b/src/corelib/kernel/qproperty.h
@@ -137,7 +137,7 @@ public:
QMetaType valueMetaType() const;
- explicit QUntypedPropertyBinding(const QPropertyBindingPrivatePtr &priv);
+ explicit QUntypedPropertyBinding(QPropertyBindingPrivate *priv);
private:
friend class QtPrivate::QPropertyBase;
friend class QPropertyBindingPrivate;
diff --git a/src/corelib/kernel/qpropertybinding.cpp b/src/corelib/kernel/qpropertybinding.cpp
index 8fdf770d18..358977e63e 100644
--- a/src/corelib/kernel/qpropertybinding.cpp
+++ b/src/corelib/kernel/qpropertybinding.cpp
@@ -134,7 +134,7 @@ QUntypedPropertyBinding &QUntypedPropertyBinding::operator=(QUntypedPropertyBind
return *this;
}
-QUntypedPropertyBinding::QUntypedPropertyBinding(const QPropertyBindingPrivatePtr &priv)
+QUntypedPropertyBinding::QUntypedPropertyBinding(QPropertyBindingPrivate *priv)
: d(priv)
{
}
diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h
index 1329ec6682..4b0b09d9db 100644
--- a/src/corelib/kernel/qpropertyprivate.h
+++ b/src/corelib/kernel/qpropertyprivate.h
@@ -83,7 +83,7 @@ public:
bool hasBinding() const { return d_ptr & BindingBit; }
QUntypedPropertyBinding setBinding(const QUntypedPropertyBinding &newBinding, void *propertyDataPtr);
- QPropertyBindingPrivatePtr binding();
+ QPropertyBindingPrivate *binding();
void evaluateIfDirty();
void removeBinding();