From 3f2183ce2c41c5a998fcc1f83ca5ad4adc82b795 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 23 Jun 2023 17:11:35 +0200 Subject: QQmlRefCount: de-virtualize dtor Now that QQmlRefCounted ensures no-one uses ~QQmlRefCount() directly anymore, we can make it non-virtual, shrinking the sizeof(QQmlRefCount) from 8/16 to 4/4 bytes (32/64 bit platforms). This requires moving the release() function from QQmlRefCount down into QQmlRefCounted, and static_cast'ing *this to T before calling delete. We need to be careful, of course, that no derived class relied on the implied virtualness of ~QQmlRefCount() making their dtors virtual, so require that all classes that use QQmlRefCounted are either final or have a virtual destructor. Update the toolsupport test and the TypeInformationVersion, as sizeof(QQmlRefCount) was one the items checked. Fixes: QTBUG-114817 Change-Id: I69afd36ec5b63313842c1438e0244503603ed96f Reviewed-by: Ulf Hermann --- src/qml/qml/qqmlproperty_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/qml/qqmlproperty_p.h') diff --git a/src/qml/qml/qqmlproperty_p.h b/src/qml/qml/qqmlproperty_p.h index 2ba8304f34..da1b7693e3 100644 --- a/src/qml/qml/qqmlproperty_p.h +++ b/src/qml/qml/qqmlproperty_p.h @@ -35,7 +35,7 @@ class QQmlMetaObject; class QQmlAbstractBinding; class QQmlBoundSignalExpression; -class Q_QML_PRIVATE_EXPORT QQmlPropertyPrivate : public QQmlRefCounted +class Q_QML_PRIVATE_EXPORT QQmlPropertyPrivate final : public QQmlRefCounted { public: enum class InitFlag { -- cgit v1.2.3