summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpicture.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2012-01-29 20:32:22 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-01 22:23:55 +0100
commitb69bb01f11f5104d8e807c7a2bdc92d3ffa394b4 (patch)
tree1f363f3922a4e51287bd0e6eac1b1f14ff2ba3b1 /src/gui/image/qpicture.cpp
parentc094891db377d750c0e8290b98971b69161a0552 (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/gui/image/qpicture.cpp')
-rw-r--r--src/gui/image/qpicture.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index f9f96f4f13..089cc5011c 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -1425,20 +1425,16 @@ QPictureHandler::QPictureHandler(const char *f, const char *h, const QByteArray&
typedef QList<QPictureHandler *> QPHList;
Q_GLOBAL_STATIC(QPHList, pictureHandlers)
-#ifndef QT_NO_LIBRARY
-Q_GLOBAL_STATIC(QMutex, mutex)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, factoryLoader,
- (QPictureFormatInterface_iid,
- QLatin1String("/pictureformats")))
-#endif
void qt_init_picture_plugins()
{
#ifndef QT_NO_LIBRARY
- QMutexLocker locker(mutex());
- QFactoryLoader *loader = factoryLoader();
- QStringList keys = loader->keys();
+ static QBasicMutex mutex;
+ QMutexLocker locker(&mutex);
+ static QFactoryLoader loader(QPictureFormatInterface_iid,
+ QStringLiteral("/pictureformats"));
+ QStringList keys = loader.keys();
for (int i = 0; i < keys.count(); ++i)
- if (QPictureFormatInterface *format = qobject_cast<QPictureFormatInterface*>(loader->instance(keys.at(i))))
+ if (QPictureFormatInterface *format = qobject_cast<QPictureFormatInterface*>(loader.instance(keys.at(i))))
format->installIOHandler(keys.at(i));
#endif
}