From f7a0c2b78cb57239cb1f66f0b3e83a9fdcafa684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 21 Jan 2018 22:16:33 +0100 Subject: [PATCH] SceneGraph: behave properly when deleting a running animable. The test now passes again. --- src/Magnum/SceneGraph/Animable.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Magnum/SceneGraph/Animable.hpp b/src/Magnum/SceneGraph/Animable.hpp index ed8e8b272..cc6270981 100644 --- a/src/Magnum/SceneGraph/Animable.hpp +++ b/src/Magnum/SceneGraph/Animable.hpp @@ -38,7 +38,12 @@ namespace Magnum { namespace SceneGraph { template Animable::Animable(AbstractObject& object, AnimableGroup* group): AbstractGroupedFeature, T>{object, group}, _duration{0.0f}, _startTime{Constants::inf()}, _pauseTime{-Constants::inf()}, _previousState{AnimationState::Stopped}, _currentState{AnimationState::Stopped}, _repeated{false}, _repeatCount{0}, _repeats{0} {} -template Animable::~Animable() {} +template Animable::~Animable() { + /* Update count of running animations when deleting an animable that's + currently running */ + if(animables() && _currentState == AnimationState::Running) + --animables()->_runningCount; +} template Animable& Animable::setState(AnimationState state) { if(_currentState == state) return *this;