summaryrefslogtreecommitdiffstats
path: root/src/corelib/animation/qpropertyanimation.cpp
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-05 08:09:00 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-05 08:09:00 (GMT)
commitbb587db95d7c20344c0bf06a1f080c0a2e4a9250 (patch)
tree50c4615c0c5908bb5a26c1a3ee121dd1f7f070be /src/corelib/animation/qpropertyanimation.cpp
parentf26f5b230e614faecce33cf52af0a0d62dcaddaa (diff)
parent555018baf3115cb2587d2217bf1a5b8f49564ad2 (diff)
downloadQt-bb587db95d7c20344c0bf06a1f080c0a2e4a9250.zip
Qt-bb587db95d7c20344c0bf06a1f080c0a2e4a9250.tar.gz
Qt-bb587db95d7c20344c0bf06a1f080c0a2e4a9250.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/corelib/animation/qpropertyanimation.cpp')
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index 43b5283..65f1361 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -87,23 +87,21 @@
\sa QVariantAnimation, QAnimationGroup, {The Animation Framework}
*/
-#ifndef QT_NO_ANIMATION
-
#include "qpropertyanimation.h"
#include "qanimationgroup.h"
-#include <QtCore/qdebug.h>
-
#include "qpropertyanimation_p.h"
#include <QtCore/qmath.h>
#include <QtCore/qmutex.h>
+#include <private/qmutexpool_p.h>
+
+#ifndef QT_NO_ANIMATION
QT_BEGIN_NAMESPACE
typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;
typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash;
Q_GLOBAL_STATIC(QPropertyAnimationHash, _q_runningAnimations)
-Q_GLOBAL_STATIC_WITH_ARGS(QMutex, guardHashLock, (QMutex::Recursive) )
void QPropertyAnimationPrivate::updateMetaProperty()
{
@@ -284,27 +282,32 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState,
}
QVariantAnimation::updateState(oldState, newState);
- QMutexLocker locker(guardHashLock());
- QPropertyAnimationHash * hash = _q_runningAnimations();
- QPropertyAnimationPair key(d->target, d->propertyName);
- if (newState == Running) {
- d->updateMetaProperty();
- QPropertyAnimation *oldAnim = hash->value(key, 0);
- if (oldAnim) {
- // try to stop the top level group
- QAbstractAnimation *current = oldAnim;
- while (current->group() && current->state() != Stopped)
- current = current->group();
- current->stop();
- }
- hash->insert(key, this);
- // update the default start value
- if (oldState == Stopped) {
- d->setDefaultStartValue(d->target->property(d->propertyName.constData()));
+ QPropertyAnimation *animToStop = 0;
+ {
+ QPropertyAnimationHash * hash = _q_runningAnimations();
+ QMutexLocker locker(QMutexPool::globalInstanceGet(hash));
+ QPropertyAnimationPair key(d->target, d->propertyName);
+ if (newState == Running) {
+ d->updateMetaProperty();
+ 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);
+ }
+
+ //we need to do that after the mutex was unlocked
+ if (animToStop) {
+ // try to stop the top level group
+ QAbstractAnimation *current = animToStop;
+ while (current->group() && current->state() != Stopped)
+ current = current->group();
+ current->stop();
}
}