diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-07-08 16:22:09 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-07-08 16:22:09 (GMT) |
commit | cfacb284593008094136905a2497843a4bbac639 (patch) | |
tree | e8ce135c34a0fb665578ef485a265ac203e3bfc9 | |
parent | 34357998f38614a7c724ba4561c0e68b19fffc4a (diff) | |
download | Qt-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
-rw-r--r-- | src/corelib/animation/qpropertyanimation.cpp | 18 |
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); } } |