From 0eec47c65982f586a8602af964b454494f0f49f3 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Tue, 29 May 2012 09:50:08 +1000 Subject: [PATCH] Fix memory leaks in QQuickParentAnimation Change-Id: I7b386b3b5f974e068c7ca00d3d9ea92a62fc70d9 Reviewed-by: Michael Brasser --- src/quick/items/qquickitemanimation.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp index 5409203..e79b9c3 100644 --- a/src/quick/items/qquickitemanimation.cpp +++ b/src/quick/items/qquickitemanimation.cpp @@ -371,13 +371,13 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act } } - QSequentialAnimationGroupJob *topLevelGroup = new QSequentialAnimationGroupJob; - QActionAnimation *viaAction = d->via ? new QActionAnimation : 0; - QActionAnimation *targetAction = new QActionAnimation; - //we'll assume the common case by far is to have children, and always create ag - QParallelAnimationGroupJob *ag = new QParallelAnimationGroupJob; - if (data->actions.count()) { + QSequentialAnimationGroupJob *topLevelGroup = new QSequentialAnimationGroupJob; + QActionAnimation *viaAction = d->via ? new QActionAnimation : 0; + QActionAnimation *targetAction = new QActionAnimation; + //we'll assume the common case by far is to have children, and always create ag + QParallelAnimationGroupJob *ag = new QParallelAnimationGroupJob; + if (d->via) viaAction->setAnimAction(viaData); targetAction->setAnimAction(data); @@ -405,12 +405,12 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act topLevelGroup->appendAnimation(ag); topLevelGroup->appendAnimation(d->via ? viaAction : targetAction); } + return initInstance(topLevelGroup); } else { delete data; delete viaData; } - - return initInstance(topLevelGroup); + return 0; } /*! -- 2.7.4