diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 6155b43e0f4..21e4c294c91 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -5,7 +5,6 @@ #include "qfactoryloader_p.h" #include "private/qcoreapplication_p.h" -#include "private/qduplicatetracker_p.h" #include "private/qloggingregistry_p.h" #include "qcborarray.h" #include "qcbormap.h" @@ -16,20 +15,11 @@ #include "qjsonarray.h" #include "qjsondocument.h" #include "qjsonobject.h" -#include "qmutex.h" #include "qplugin.h" -#include "qplugin_p.h" #include "qpluginloader.h" -#if QT_CONFIG(library) -# include "qlibrary_p.h" -#endif - #include -#include -#include - QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; @@ -247,28 +237,6 @@ QJsonObject QPluginParsedMetaData::toJson() const return o; } -class QFactoryLoaderPrivate -{ - Q_DISABLE_COPY_MOVE(QFactoryLoaderPrivate) -public: - QFactoryLoaderPrivate() { } - QByteArray iid; - mutable QMutex mutex; - mutable QList usedStaticInstances; -#if QT_CONFIG(library) - ~QFactoryLoaderPrivate(); - QDuplicateTracker loadedPaths; - std::vector libraries; - mutable QList loadedLibraries; - std::map keyMap; - QString suffix; - QString extraSearchPath; - Qt::CaseSensitivity cs; - - void updateSinglePath(const QString &pluginDir); -#endif -}; - #if QT_CONFIG(library) Q_STATIC_LOGGING_CATEGORY_WITH_ENV_OVERRIDE(lcFactoryLoader, "QT_DEBUG_PLUGINS", @@ -286,10 +254,7 @@ struct QFactoryLoaderGlobals Q_GLOBAL_STATIC(QFactoryLoaderGlobals, qt_factoryloader_global) -QFactoryLoaderPrivate::~QFactoryLoaderPrivate() - = default; - -inline void QFactoryLoaderPrivate::updateSinglePath(const QString &path) +inline void QFactoryLoader::Private::updateSinglePath(const QString &path) { struct LibraryReleaser { void operator()(QLibraryPrivate *library) @@ -462,7 +427,6 @@ void QFactoryLoader::refreshAll() QFactoryLoader::QFactoryLoader(const char *iid, const QString &suffix, Qt::CaseSensitivity cs) - : d(new QFactoryLoaderPrivate) { Q_ASSERT_X(suffix.startsWith(u'/'), "QFactoryLoader", "For historical reasons, the suffix must start with '/' (and it can't be empty)"); diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h index 8892d217ad0..c14e5795a8f 100644 --- a/src/corelib/plugin/qfactoryloader_p.h +++ b/src/corelib/plugin/qfactoryloader_p.h @@ -20,19 +20,22 @@ #ifndef QT_NO_QOBJECT #include "QtCore/private/qplugin_p.h" -#include "QtCore/qcbormap.h" -#include "QtCore/qcborvalue.h" +#include "QtCore/private/qduplicatetracker_p.h" #include "QtCore/qcoreapplication.h" #include "QtCore/qmap.h" +#include "QtCore/qmutex.h" #include "QtCore/qobject.h" #include "QtCore/qplugin.h" +#if QT_CONFIG(library) +# include "QtCore/private/qlibrary_p.h" +#endif + QT_BEGIN_NAMESPACE class QJsonObject; class QLibraryPrivate; -class QFactoryLoaderPrivate; class Q_CORE_EXPORT QFactoryLoader { Q_DECLARE_TR_FUNCTIONS(QFactoryLoader); @@ -64,7 +67,25 @@ public: QObject *instance(int index) const; private: - std::unique_ptr d; + struct Private { + QByteArray iid; + mutable QMutex mutex; + mutable QList usedStaticInstances; +#if QT_CONFIG(library) + QDuplicateTracker loadedPaths; + std::vector libraries; + mutable QList loadedLibraries; + std::map keyMap; + QString suffix; + QString extraSearchPath; + Qt::CaseSensitivity cs; + void updateSinglePath(const QString &pluginDir); +#endif + + // for compat when we d was a pointer + auto operator->() { return this; } + auto operator->() const { return this; } + } d; inline QObject *instanceHelper_locked(int index) const; };