mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 00:12:15 -07:00
Animation safety.
Took 12 minutes
This commit is contained in:
parent
f4fbe90a72
commit
7b47b5992f
2 changed files with 5 additions and 2 deletions
|
|
@ -54,9 +54,9 @@ void CardItem::prepareDelete()
|
|||
|
||||
void CardItem::deleteLater()
|
||||
{
|
||||
prepareDelete();
|
||||
if (scene())
|
||||
static_cast<GameScene *>(scene())->unregisterAnimationItem(this);
|
||||
prepareDelete();
|
||||
AbstractCardItem::deleteLater();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -304,8 +304,11 @@ void GameScene::timerEvent(QTimerEvent * /*event*/)
|
|||
QMutableSetIterator<CardItem *> i(cardsToAnimate);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
if (!i.value()->animationEvent())
|
||||
if (i.value() == nullptr) {
|
||||
i.remove();
|
||||
} else if (!i.value()->animationEvent()) {
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
if (cardsToAnimate.isEmpty())
|
||||
animationTimer->stop();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue