QPropertyAnimation::setTargetObject() fails if new and old target object have the same address
If a target object is destroyed QPropertyAnimationPrivate::targetValue reflects this while QPropertyAnimationPrivate::target stays unchanged. QPropertyAnimation::setTargetObject() checks if a new target matches QPropertyAnimationPrivate::target - to bad if the former target has been destroyed in the meanwhile but the new one has the same memory address. targetValue is not updated in this case. It will still point to null and QPropertyAnimation::targetObject() returns 0. This is not just a theoretical problem - we stubled upon this in Harmattan when suddenly animations complained that they are having no target. Change-Id: Ib4a9c234d04d6f8a3f7aed251d5e79471d95168a Reviewed-by: Leonardo Sobral Cunha <leo.cunha@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
This commit is contained in:
parent
43696a9e42
commit
d0cb57a4e7
@ -187,7 +187,7 @@ QObject *QPropertyAnimation::targetObject() const
|
||||
void QPropertyAnimation::setTargetObject(QObject *target)
|
||||
{
|
||||
Q_D(QPropertyAnimation);
|
||||
if (d->targetValue == target)
|
||||
if (d->target.data() == target)
|
||||
return;
|
||||
|
||||
if (d->state != QAbstractAnimation::Stopped) {
|
||||
|
Loading…
Reference in New Issue
Block a user