tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
    73     void stopUncontrolledAnimations();
    73     void stopUncontrolledAnimations();
    74     void loopCount_data();
    74     void loopCount_data();
    75     void loopCount();
    75     void loopCount();
    76     void autoAdd();
    76     void autoAdd();
    77     void pauseResume();
    77     void pauseResume();
       
    78 
       
    79     void QTBUG8910_crashWhenRemovingUncontrolledAnimation();
    78 };
    80 };
    79 
    81 
    80 tst_QParallelAnimationGroup::tst_QParallelAnimationGroup()
    82 tst_QParallelAnimationGroup::tst_QParallelAnimationGroup()
    81 {
    83 {
    82 }
    84 }
   997     QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy.last().first()), TestAnimation::Stopped);
   999     QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy.last().first()), TestAnimation::Stopped);
   998     group.pause();
  1000     group.pause();
   999     QCOMPARE(spy.count(), 2); //this shouldn't have changed
  1001     QCOMPARE(spy.count(), 2); //this shouldn't have changed
  1000     group.resume();
  1002     group.resume();
  1001     QCOMPARE(spy.count(), 2); //this shouldn't have changed
  1003     QCOMPARE(spy.count(), 2); //this shouldn't have changed
  1002 
  1004 }
  1003 
  1005 
  1004 
  1006 
       
  1007 void tst_QParallelAnimationGroup::QTBUG8910_crashWhenRemovingUncontrolledAnimation()
       
  1008 {
       
  1009     QParallelAnimationGroup group;
       
  1010     TestAnimation *anim = new TestAnimation;
       
  1011     anim->setLoopCount(-1);
       
  1012     TestAnimation *anim2 = new TestAnimation;
       
  1013     anim2->setLoopCount(-1);
       
  1014     group.addAnimation(anim);
       
  1015     group.addAnimation(anim2);
       
  1016     group.start();
       
  1017     delete anim;
       
  1018     // it would crash here because the internals of the group would still have a reference to anim
       
  1019     delete anim2;
  1005 }
  1020 }
  1006 
  1021 
  1007 
  1022 
  1008 QTEST_MAIN(tst_QParallelAnimationGroup)
  1023 QTEST_MAIN(tst_QParallelAnimationGroup)
  1009 #include "tst_qparallelanimationgroup.moc"
  1024 #include "tst_qparallelanimationgroup.moc"