summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2010-03-17 11:14:15 +0100
committerThierry Bastian <thierry.bastian@nokia.com>2010-03-17 11:30:59 +0100
commit3a5f473a16b3bc64e6793a9a5002d961a2a0762a (patch)
treec1becbb38ab0bc02e5eebfd18862e36e0f4d037c /tests
parent0ee7b05373d6d7097f3f8c9479c80f936921625e (diff)
Fix a crash in animation groups when deleting uncontrolled animations
The problem was that we were not removing their references from the private object hash and at some point we could access it. Task-number: QTBUG-8910 Reviewed-by: gabi
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
index fb0f3e0780..d2d86fb994 100644
--- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
+++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
@@ -75,6 +75,8 @@ private slots:
void loopCount();
void autoAdd();
void pauseResume();
+
+ void QTBUG8910_crashWhenRemovingUncontrolledAnimation();
};
tst_QParallelAnimationGroup::tst_QParallelAnimationGroup()
@@ -999,9 +1001,22 @@ void tst_QParallelAnimationGroup::pauseResume()
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;
}