diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2012-01-29 20:32:22 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-01 22:23:55 +0100 |
commit | b69bb01f11f5104d8e807c7a2bdc92d3ffa394b4 (patch) | |
tree | 1f363f3922a4e51287bd0e6eac1b1f14ff2ba3b1 /src/corelib/plugin | |
parent | c094891db377d750c0e8290b98971b69161a0552 (diff) |
Use QBasicMutex instead of Q_GLOBAL_STATIC QMutex
QBasicMutex is a POD and can be used as a static global object.
in qpicture.cpp factoryLoader is used only once, and under the mutex, so
there is no need for Q_GLOBAL_STATIC for it, it can be a function static
in qhostinfo_unix.cpp the code seemed wrong while compiled with
namespace and QT_NO_GETADDRINFO. I also could get rid of one include
because it was included earlier.
Change-Id: I3c700203c3e067266c20733f4bda8031446dbb86
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index a754f1b56a..dc08b32db1 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE # define QT_NO_DEBUG_PLUGIN_CHECK #endif -Q_GLOBAL_STATIC(QMutex, qt_library_mutex) +static QBasicMutex qt_library_mutex; /*! \class QLibrary @@ -452,7 +452,7 @@ QLibraryPrivate::QLibraryPrivate(const QString &canonicalFileName, const QString QLibraryPrivate *QLibraryPrivate::findOrCreate(const QString &fileName, const QString &version) { - QMutexLocker locker(qt_library_mutex()); + QMutexLocker locker(&qt_library_mutex); if (QLibraryPrivate *lib = libraryMap()->value(fileName)) { lib->libraryRefCount.ref(); return lib; @@ -526,7 +526,7 @@ bool QLibraryPrivate::unload() void QLibraryPrivate::release() { - QMutexLocker locker(qt_library_mutex()); + QMutexLocker locker(&qt_library_mutex); if (!libraryRefCount.deref()) delete this; } |