diff --git a/src/helpers/AnimatedVariable.cpp b/src/helpers/AnimatedVariable.cpp index c4a1713d..77707349 100644 --- a/src/helpers/AnimatedVariable.cpp +++ b/src/helpers/AnimatedVariable.cpp @@ -54,10 +54,13 @@ CAnimatedVariable::~CAnimatedVariable() { void CAnimatedVariable::unregister() { g_pAnimationManager->m_lAnimatedVariables.remove(this); + m_bIsRegistered = false; } void CAnimatedVariable::registerVar() { - g_pAnimationManager->m_lAnimatedVariables.push_back(this); + if (!m_bIsRegistered) + g_pAnimationManager->m_lAnimatedVariables.push_back(this); + m_bIsRegistered = true; } int CAnimatedVariable::getDurationLeftMs() { diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp index 22c5da84..7b5a6895 100644 --- a/src/helpers/AnimatedVariable.hpp +++ b/src/helpers/AnimatedVariable.hpp @@ -200,6 +200,7 @@ private: SAnimationPropertyConfig* m_pConfig = nullptr; bool m_bDummy = true; + bool m_bIsRegistered = false; std::chrono::system_clock::time_point animationBegin;