From ff76fbe763ade84d97f3b50bc08276cdd0e7471e Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 5 Nov 2022 13:37:29 +0000 Subject: prevent double-registering of avars --- src/helpers/AnimatedVariable.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/helpers/AnimatedVariable.cpp') 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() { -- cgit v1.2.3