summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/helpers/AnimatedVariable.hpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp
index 58efb956..d819ce1f 100644
--- a/src/helpers/AnimatedVariable.hpp
+++ b/src/helpers/AnimatedVariable.hpp
@@ -268,8 +268,10 @@ class CAnimatedVariable {
// methods
void onAnimationEnd() {
if (m_fEndCallback) {
+ // loading m_bRemoveEndAfterRan before calling the callback allows the callback to delete this animation safely if it is false.
+ auto removeEndCallback = m_bRemoveEndAfterRan;
m_fEndCallback(this);
- if (m_bRemoveEndAfterRan)
+ if (removeEndCallback)
m_fEndCallback = nullptr; // reset
}
}