summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qlibrary_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-07-21 16:36:24 -0700
committerThiago Macieira <thiago.macieira@intel.com>2014-07-23 17:50:23 +0200
commitcfaf851e268dac95cb140fbffc1233981ce48d4c (patch)
tree0a8ae098f6636fa301c48c3c17a4e9fefdb1e184 /src/corelib/plugin/qlibrary_p.h
parent800d0076e0adaeb751f7040fbd7476292e1a2af9 (diff)
Fix a few more race conditions with QLibrary::LoadHints
This commit makes replaces the loadHints member with a setter, a getter and an atomic variable. The setter will not set anything if the library has already been loaded. Task-number: QTBUG-39642 Change-Id: Ibb7692f16d80211b52aaf4dc88db1a989738a24d Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib/plugin/qlibrary_p.h')
-rw-r--r--src/corelib/plugin/qlibrary_p.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h
index e58d18e87b..df95d1342d 100644
--- a/src/corelib/plugin/qlibrary_p.h
+++ b/src/corelib/plugin/qlibrary_p.h
@@ -94,6 +94,10 @@ public:
void release();
QFunctionPointer resolve(const char *);
+ QLibrary::LoadHints loadHints() const
+ { return QLibrary::LoadHints(loadHintsInt.load()); }
+ void setLoadHints(QLibrary::LoadHints lh);
+
static QLibraryPrivate *findOrCreate(const QString &fileName, const QString &version = QString(),
QLibrary::LoadHints loadHints = 0);
static QStringList suffixes_sys(const QString &fullVersion);
@@ -104,7 +108,6 @@ public:
QJsonObject metaData;
QString errorString;
- QLibrary::LoadHints loadHints;
void updatePluginState();
bool isPlugin();
@@ -126,6 +129,8 @@ private:
bool unload_sys();
QFunctionPointer resolve_sys(const char *);
+ QAtomicInt loadHintsInt;
+
/// counts how many QLibrary or QPluginLoader are attached to us, plus 1 if it's loaded
QAtomicInt libraryRefCount;
/// counts how many times load() or loadPlugin() were called