From 54232d6ea98a313390ee8f36bbadadce49ff97f3 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 29 Sep 2020 18:11:23 +0200 Subject: Streamline the template specialization of QESDP's dtor Declaring and implementing out of line a specialization for QESDP's destructor is needed if we have an implicitly shared type and we want to provide an inline move constructor for it. The code is however a bit heavy on the eyes, and the full implementation for the destructor must be provided (read: copy and pasted) -- the specialization destructor cannot just "reuse" the one from the primary template. This patch adds a few macros to streamline the above, so that we can start using the same pattern in more places. These macros are completely private for the moment being; we don't want to push this solution for our users. Port QPixmap to the new macros. Change-Id: Ia6a51ad988483e44c9d97c0eca2fb003b6bd21e3 Reviewed-by: Thiago Macieira --- src/gui/image/qpixmap.cpp | 5 ++--- src/gui/image/qpixmap.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/gui/image') diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index c3ae853795..d8473001aa 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -229,9 +229,8 @@ QPixmap::QPixmap(const QPixmap &pixmap) \sa swap() operator=(QPixmap&&) */ -template<> -QExplicitlySharedDataPointer::~QExplicitlySharedDataPointer() -{ if (d && !d->ref.deref()) delete d; } + +QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QPlatformPixmap) /*! Constructs a pixmap from the given \a xpm data, which must be a diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index e731597659..42d4e27102 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -57,7 +57,7 @@ class QImageReader; class QColor; class QVariant; class QPlatformPixmap; -template<> Q_GUI_EXPORT QExplicitlySharedDataPointer::~QExplicitlySharedDataPointer(); +QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlatformPixmap, Q_GUI_EXPORT) class Q_GUI_EXPORT QPixmap : public QPaintDevice { -- cgit v1.2.3