From d0cb57a4e7c028117c253726a15dd60099e7cc8a Mon Sep 17 00:00:00 2001 From: Armin Berres Date: Thu, 10 Nov 2011 17:34:55 +0100 Subject: 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 Reviewed-by: Robin Burchell --- src/corelib/animation/qpropertyanimation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index 816c725ebc..a18f0f1a70 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -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) { -- cgit v1.2.3