summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-11-05 13:37:29 +0000
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-11-05 13:37:29 +0000
commitff76fbe763ade84d97f3b50bc08276cdd0e7471e (patch)
tree441f5a16a39cfdd92e336e79f146f2263ac855a2 /src
parentcfbab453e88336c4714868f40eb3c8b159cfa783 (diff)
prevent double-registering of avars
Diffstat (limited to 'src')
-rw-r--r--src/helpers/AnimatedVariable.cpp5
-rw-r--r--src/helpers/AnimatedVariable.hpp1
2 files changed, 5 insertions, 1 deletions
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;