From 75e9f05bf3c1441ac0c1ff09b7c1e34b78e15a65 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 29 May 2012 11:15:11 +1000 Subject: Change animation grouping and ownership model. Don't rely on QObject ownership. Change-Id: Id1b27a5f8a15ef24c34b206d5736aad344bf9ada Reviewed-by: Yunqiao Yin --- src/quick/util/qquickanimation.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/quick/util/qquickanimation.cpp') diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp index bc39355a48..f6e2e57cc8 100644 --- a/src/quick/util/qquickanimation.cpp +++ b/src/quick/util/qquickanimation.cpp @@ -89,6 +89,8 @@ QQuickAbstractAnimation::QQuickAbstractAnimation(QObject *parent) QQuickAbstractAnimation::~QQuickAbstractAnimation() { Q_D(QQuickAbstractAnimation); + if (d->group) + setGroup(0); //remove from group delete d->animationInstance; } @@ -431,15 +433,12 @@ void QQuickAbstractAnimation::setGroup(QQuickAnimationGroup *g) if (d->group == g) return; if (d->group) - static_cast(d->group->d_func())->animations.removeAll(this); + d->group->d_func()->animations.removeAll(this); d->group = g; - if (d->group && !static_cast(d->group->d_func())->animations.contains(this)) - static_cast(d->group->d_func())->animations.append(this); - - //if (g) //if removed from a group, then the group should no longer be the parent - setParent(g); + if (d->group && !d->group->d_func()->animations.contains(this)) + d->group->d_func()->animations.append(this); } /*! @@ -1620,6 +1619,10 @@ void QQuickAnimationGroupPrivate::clear_animation(QQmlListPropertyanimations.count(); ++i) + d->animations.at(i)->d_func()->group = 0; + d->animations.clear(); } QQmlListProperty QQuickAnimationGroup::animations() -- cgit v1.2.3