Fix QCommonStylePrivate::stopAnimation()

Make sure that QCommonStylePrivate::animation() does
not return an animation that was already stopped.

Change-Id: I35b7f8e0fabff9908f247b3632e35388e2c95a6d
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
This commit is contained in:
J-P Nurmi 2012-10-30 15:38:32 +01:00 committed by The Qt Project
parent 85a8df184b
commit dca34854ef

View File

@ -1081,13 +1081,9 @@ void QCommonStylePrivate::startAnimation(QStyleAnimation *animation) const
/*! \internal */
void QCommonStylePrivate::stopAnimation(const QObject *target) const
{
QStyleAnimation *animation = animations.value(target);
if (animation) {
if (animation->state() == QAbstractAnimation::Stopped)
animations.take(target)->deleteLater();
else
animation->stop();
}
QStyleAnimation *animation = animations.take(target);
if (animation && animation->state() != QAbstractAnimation::Stopped)
animation->stop();
}
/*! \internal */