tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
--- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -75,6 +75,8 @@
     void loopCount();
     void autoAdd();
     void pauseResume();
+
+    void QTBUG8910_crashWhenRemovingUncontrolledAnimation();
 };
 
 tst_QParallelAnimationGroup::tst_QParallelAnimationGroup()
@@ -999,9 +1001,22 @@
     QCOMPARE(spy.count(), 2); //this shouldn't have changed
     group.resume();
     QCOMPARE(spy.count(), 2); //this shouldn't have changed
+}
 
 
-
+void tst_QParallelAnimationGroup::QTBUG8910_crashWhenRemovingUncontrolledAnimation()
+{
+    QParallelAnimationGroup group;
+    TestAnimation *anim = new TestAnimation;
+    anim->setLoopCount(-1);
+    TestAnimation *anim2 = new TestAnimation;
+    anim2->setLoopCount(-1);
+    group.addAnimation(anim);
+    group.addAnimation(anim2);
+    group.start();
+    delete anim;
+    // it would crash here because the internals of the group would still have a reference to anim
+    delete anim2;
 }