From 845491ed3b38eb756cd73cf4161f440559c9a6a6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 19 May 2022 09:36:11 -0700 Subject: QFileSystemModelPrivate: de-inline ctor and dtor This class is dllexport'ed and has members that refer to classes that are only forward-declared in the header (such as QRegularExpression, used in std::vector). GCC and MSVC appear to emit the destructor at the point where it is used, which I guess is the vtable, which probably means where the constructor was inlined because I don't see any virtual overrides. Clang (at least in the form of ICX) appears to emit it at the class declaration point. C:\Qt\qt-everywhere-src-6.3.0\qtbase\src\gui\itemmodels/qfilesystemmodel_p.h(94,20): note: in instantiation of member function 'std::vector::~vector' requested here class Q_GUI_EXPORT QFileSystemModelPrivate : public QAbstractItemModelPrivate ^ C:\Qt\qt-everywhere-src-6.3.0\qtbase\src\gui\itemmodels/qfilesystemmodel_p.h(94,20): note: in implicit destructor for 'QFileSystemModelPrivate' first required here C:\Qt\qt-everywhere-src-6.3.0\qtbase\src\gui\itemmodels/qfilesystemmodel_p.h(94,7): note: due to 'QFileSystemModelPrivate' being dllexported Fix by defining both the default ctor and the dtor out-of-line. Task-number: QTBUG-45582 Fixes: QTBUG-103605 Pick-to: 5.15 6.2 6.3 Change-Id: I77c8221eb2824c369feffffd16f08ee39004a825 Reviewed-by: Thiago Macieira --- src/gui/itemmodels/qfilesystemmodel.cpp | 4 ++++ src/gui/itemmodels/qfilesystemmodel_p.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/itemmodels/qfilesystemmodel.cpp b/src/gui/itemmodels/qfilesystemmodel.cpp index ac6d1dca8d..f0dcb6d801 100644 --- a/src/gui/itemmodels/qfilesystemmodel.cpp +++ b/src/gui/itemmodels/qfilesystemmodel.cpp @@ -2036,6 +2036,10 @@ QStringList QFileSystemModelPrivate::unwatchPathsAt(const QModelIndex &index) } #endif // filesystemwatcher && Q_OS_WIN +QFileSystemModelPrivate::QFileSystemModelPrivate() = default; + +QFileSystemModelPrivate::~QFileSystemModelPrivate() = default; + /*! \internal */ diff --git a/src/gui/itemmodels/qfilesystemmodel_p.h b/src/gui/itemmodels/qfilesystemmodel_p.h index 4be1d49cbf..3cb08d1308 100644 --- a/src/gui/itemmodels/qfilesystemmodel_p.h +++ b/src/gui/itemmodels/qfilesystemmodel_p.h @@ -179,7 +179,8 @@ public: bool isVisible = false; }; - QFileSystemModelPrivate() = default; + QFileSystemModelPrivate(); + ~QFileSystemModelPrivate(); void init(); /* \internal -- cgit v1.2.1