summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qlibrary_p.h
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-03-11 01:00:24 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2020-03-11 11:27:49 +0100
commit116d68f105db025f56c1fd5115ff4924bc22d7c2 (patch)
treeae04596b19c34eccc60ff7477da6a0166c5f82b1 /src/corelib/plugin/qlibrary_p.h
parent52de905d0ec6159d3a1e7ad63fed018b5c6973d2 (diff)
parentbd3c82f8db4391fc1d6d3338827356143fd598dd (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: src/corelib/plugin/qlibrary.cpp src/corelib/plugin/qlibrary_unix.cpp src/corelib/plugin/qpluginloader.cpp Change-Id: I866feaaa2a4936ee5389679724c8471a5b4b583d
Diffstat (limited to 'src/corelib/plugin/qlibrary_p.h')
-rw-r--r--src/corelib/plugin/qlibrary_p.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h
index a58547a2c3..3ca544b2de 100644
--- a/src/corelib/plugin/qlibrary_p.h
+++ b/src/corelib/plugin/qlibrary_p.h
@@ -54,10 +54,10 @@
#include <QtCore/private/qglobal_p.h>
#include "QtCore/qlibrary.h"
+#include "QtCore/qmutex.h"
#include "QtCore/qpointer.h"
#include "QtCore/qstringlist.h"
#include "QtCore/qplugin.h"
-#include "QtCore/qsharedpointer.h"
#ifdef Q_OS_WIN
# include "QtCore/qt_windows.h"
#endif
@@ -72,21 +72,18 @@ class QLibraryStore;
class QLibraryPrivate
{
public:
-
#ifdef Q_OS_WIN
- HINSTANCE
+ using Handle = HINSTANCE;
#else
- void *
+ using Handle = void *;
#endif
- pHnd;
-
enum UnloadFlag { UnloadSys, NoUnloadSys };
- QString fileName, qualifiedFileName;
- QString fullVersion;
+ const QString fileName;
+ const QString fullVersion;
bool load();
- bool loadPlugin(); // loads and resolves instance
+ QtPluginInstanceFunction loadPlugin(); // loads and resolves instance
bool unload(UnloadFlag flag = UnloadSys);
void release();
QFunctionPointer resolve(const char *);
@@ -94,17 +91,22 @@ public:
QLibrary::LoadHints loadHints() const
{ return QLibrary::LoadHints(loadHintsInt.loadRelaxed()); }
void setLoadHints(QLibrary::LoadHints lh);
+ QObject *pluginInstance();
static QLibraryPrivate *findOrCreate(const QString &fileName, const QString &version = QString(),
QLibrary::LoadHints loadHints = { });
static QStringList suffixes_sys(const QString &fullVersion);
static QStringList prefixes_sys();
- QPointer<QObject> inst;
- QtPluginInstanceFunction instance;
- QJsonObject metaData;
+ QAtomicPointer<std::remove_pointer<QtPluginInstanceFunction>::type> instanceFactory;
+ QAtomicPointer<std::remove_pointer<Handle>::type> pHnd;
+ // the mutex protects the fields below
+ QMutex mutex;
+ QPointer<QObject> inst; // used by QFactoryLoader
+ QJsonObject metaData;
QString errorString;
+ QString qualifiedFileName;
void updatePluginState();
bool isPlugin();