summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-08 18:22:09 +0200
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-08 18:22:09 +0200
commitcfacb284593008094136905a2497843a4bbac639 (patch)
treee8ce135c34a0fb665578ef485a265ac203e3bfc9 /src
parent34357998f38614a7c724ba4561c0e68b19fffc4a (diff)
QPropertyAnimation: save a Q_GLOBAL_STATIC
This is possible because we anyway use a Mutex to access the static hash
Diffstat (limited to 'src')
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index 7526a819be..5f224aa1da 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -100,10 +100,6 @@
QT_BEGIN_NAMESPACE
-typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;
-typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash;
-Q_GLOBAL_STATIC(QPropertyAnimationHash, _q_runningAnimations)
-
void QPropertyAnimationPrivate::updateMetaProperty()
{
if (!target || propertyName.isEmpty())
@@ -286,19 +282,21 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState,
QPropertyAnimation *animToStop = 0;
{
- QPropertyAnimationHash * hash = _q_runningAnimations();
- QMutexLocker locker(QMutexPool::globalInstanceGet(hash));
+ QMutexLocker locker(QMutexPool::globalInstanceGet(&staticMetaObject));
+ typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;
+ typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash;
+ static QPropertyAnimationHash hash;
QPropertyAnimationPair key(d->target, d->propertyName);
if (newState == Running) {
d->updateMetaProperty();
- animToStop = hash->value(key, 0);
- hash->insert(key, this);
+ animToStop = hash.value(key, 0);
+ hash.insert(key, this);
// update the default start value
if (oldState == Stopped) {
d->setDefaultStartValue(d->target->property(d->propertyName.constData()));
}
- } else if (hash->value(key) == this) {
- hash->remove(key);
+ } else if (hash.value(key) == this) {
+ hash.remove(key);
}
}