aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcontextdata_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-03-04 14:54:54 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2020-04-03 12:35:23 +0200
commit448b2a5d838d082c66ab649cc7b71c31761bf409 (patch)
tree17888b90b9e03eb52e2ba03611146a66a87e31a1 /src/qml/qml/qqmlcontextdata_p.h
parentf1fd2b982a2ceae92da9b4a3875c65ed8a49560d (diff)
Replace QFlagPointer with QTaggedPointer
The latter has the advantage of allowing the use of a real type for the tag, instead of the generic flag/flag2 boolean accessors. Change-Id: Icc9e854ce4af3eb5808a4bed45aa22f377e223da Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlcontextdata_p.h')
-rw-r--r--src/qml/qml/qqmlcontextdata_p.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlcontextdata_p.h b/src/qml/qml/qqmlcontextdata_p.h
index e31a45dea4..ccefd3a05b 100644
--- a/src/qml/qml/qqmlcontextdata_p.h
+++ b/src/qml/qml/qqmlcontextdata_p.h
@@ -278,6 +278,11 @@ private:
// id guards
struct ContextGuard : public QQmlGuard<QObject>
{
+ enum Tag {
+ NoTag,
+ ObjectWasSet
+ };
+
inline ContextGuard() : m_context(nullptr) {}
inline ContextGuard &operator=(QObject *obj);
inline void objectDestroyed(QObject *) override;
@@ -292,7 +297,7 @@ private:
private:
// Not refcounted, as it always belongs to the QQmlContextData.
- QFlagPointer<QQmlContextData> m_context;
+ QTaggedPointer<QQmlContextData, Tag> m_context;
QQmlNotifier m_bindings;
};
@@ -404,7 +409,7 @@ private:
QQmlContextData::ContextGuard &QQmlContextData::ContextGuard::operator=(QObject *obj)
{
QQmlGuard<QObject>::operator=(obj);
- m_context.setFlag();
+ m_context.setTag(ObjectWasSet);
m_bindings.notify(); // For alias connections
return *this;
}
@@ -419,7 +424,7 @@ void QQmlContextData::ContextGuard::objectDestroyed(QObject *)
bool QQmlContextData::ContextGuard::wasSet() const
{
- return m_context.flag();
+ return m_context.tag() == ObjectWasSet;
}
QT_END_NAMESPACE