From: Charles Yin Date: Mon, 28 May 2012 23:50:08 +0000 (+1000) Subject: Fix memory leaks in QQuickParentAnimation X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=0eec47c65982f586a8602af964b454494f0f49f3;p=konrad%2Fqtdeclarative.git Fix memory leaks in QQuickParentAnimation Change-Id: I7b386b3b5f974e068c7ca00d3d9ea92a62fc70d9 Reviewed-by: Michael Brasser --- 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; } /*!