summaryrefslogtreecommitdiff
path: root/src/gui/kernel/qtouchdevice.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/kernel/qtouchdevice.cpp
parentc094891db377d750c0e8290b98971b69161a0552 (diff)
downloadqtbase-b69bb01f11f5104d8e807c7a2bdc92d3ffa394b4.tar.gz
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/kernel/qtouchdevice.cpp')
-rw-r--r--src/gui/kernel/qtouchdevice.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp
index bb83fea977..b0543819df 100644
--- a/src/gui/kernel/qtouchdevice.cpp
+++ b/src/gui/kernel/qtouchdevice.cpp
@@ -177,11 +177,11 @@ void QTouchDevice::setName(const QString &name)
typedef QList<QTouchDevice *> TouchDevices;
Q_GLOBAL_STATIC(TouchDevices, deviceList)
-Q_GLOBAL_STATIC(QMutex, devicesMutex)
+static QBasicMutex devicesMutex;
static void cleanupDevicesList()
{
- QMutexLocker lock(devicesMutex());
+ QMutexLocker lock(&devicesMutex);
qDeleteAll(*deviceList());
deviceList()->clear();
}
@@ -193,7 +193,7 @@ static void cleanupDevicesList()
*/
QList<const QTouchDevice *> QTouchDevice::devices()
{
- QMutexLocker lock(devicesMutex());
+ QMutexLocker lock(&devicesMutex);
QList<QTouchDevice *> *devList = deviceList();
QList<const QTouchDevice *> constDevList;
for (int i = 0, count = devList->count(); i != count; ++i)
@@ -206,7 +206,7 @@ QList<const QTouchDevice *> QTouchDevice::devices()
*/
bool QTouchDevicePrivate::isRegistered(QTouchDevice *dev)
{
- QMutexLocker lock(devicesMutex());
+ QMutexLocker lock(&devicesMutex);
return deviceList()->contains(dev);
}
@@ -215,7 +215,7 @@ bool QTouchDevicePrivate::isRegistered(QTouchDevice *dev)
*/
void QTouchDevicePrivate::registerDevice(QTouchDevice *dev)
{
- QMutexLocker lock(devicesMutex());
+ QMutexLocker lock(&devicesMutex);
if (deviceList()->isEmpty())
qAddPostRoutine(cleanupDevicesList);
deviceList()->append(dev);