From b69bb01f11f5104d8e807c7a2bdc92d3ffa394b4 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 29 Jan 2012 20:32:22 +0100 Subject: 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 --- src/gui/kernel/qtouchdevice.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/gui/kernel/qtouchdevice.cpp') 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 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 QTouchDevice::devices() { - QMutexLocker lock(devicesMutex()); + QMutexLocker lock(&devicesMutex); QList *devList = deviceList(); QList constDevList; for (int i = 0, count = devList->count(); i != count; ++i) @@ -206,7 +206,7 @@ QList 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); -- cgit v1.2.3