diff options
author | Charles Yin <charles.yin@nokia.com> | 2012-04-03 16:52:29 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-05 08:33:59 +0200 |
commit | 2149e9e617f72324bc9297ade3dc1884e15d75c1 (patch) | |
tree | a5675b7d6eaba2bb3fcee5ea00ac77e25cf9bb29 /src | |
parent | 5874e29b851101291a93278351da32a5cdbade9c (diff) |
Rewrite QAnimationGroupJob::clear() method
Before removing and deleting children, set the m_group to 0 to avoid potential
cycling deletions when this method is called from QAnimationGroupJob::~QAnimationGroupJob().
Change-Id: Idb6920be71fc9e033e5a76b724c9550018995035
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/animations/qanimationgroupjob.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/qml/animations/qanimationgroupjob.cpp b/src/qml/animations/qanimationgroupjob.cpp index 83b2192313..59bceaaf4e 100644 --- a/src/qml/animations/qanimationgroupjob.cpp +++ b/src/qml/animations/qanimationgroupjob.cpp @@ -51,8 +51,7 @@ QAnimationGroupJob::QAnimationGroupJob() QAnimationGroupJob::~QAnimationGroupJob() { - while (firstChild() != 0) - delete firstChild(); + clear(); } void QAnimationGroupJob::topLevelAnimationLoopChanged() @@ -123,9 +122,16 @@ void QAnimationGroupJob::removeAnimation(QAbstractAnimationJob *animation) void QAnimationGroupJob::clear() { - //### should this remove and delete, or just remove? - while (firstChild() != 0) - delete firstChild(); //removeAnimation(firstChild()); + QAbstractAnimationJob *child = firstChild(); + QAbstractAnimationJob *nextSibling = 0; + while (child != 0) { + child->m_group = 0; + nextSibling = child->nextSibling(); + delete child; + child = nextSibling; + } + m_firstChild = 0; + m_lastChild = 0; } void QAnimationGroupJob::resetUncontrolledAnimationsFinishTime() |