From 448b2a5d838d082c66ab649cc7b71c31761bf409 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 4 Mar 2020 14:54:54 +0100 Subject: 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 --- src/qml/qml/qqmlcontextdata_p.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/qml/qml/qqmlcontextdata_p.h') 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 { + 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 m_context; + QTaggedPointer m_context; QQmlNotifier m_bindings; }; @@ -404,7 +409,7 @@ private: QQmlContextData::ContextGuard &QQmlContextData::ContextGuard::operator=(QObject *obj) { QQmlGuard::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 -- cgit v1.2.3