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;