summaryrefslogtreecommitdiffstats
path: root/src/corelib/animation
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-08 16:22:09 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-08 16:22:09 (GMT)
commitcfacb284593008094136905a2497843a4bbac639 (patch)
treee8ce135c34a0fb665578ef485a265ac203e3bfc9 /src/corelib/animation
parent34357998f38614a7c724ba4561c0e68b19fffc4a (diff)
downloadQt-cfacb284593008094136905a2497843a4bbac639.zip
Qt-cfacb284593008094136905a2497843a4bbac639.tar.gz
Qt-cfacb284593008094136905a2497843a4bbac639.tar.bz2
QPropertyAnimation: save a Q_GLOBAL_STATIC
This is possible because we anyway use a Mutex to access the static hash
Diffstat (limited to 'src/corelib/animation')
-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 7526a81..5f224aa 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);
}
}