summaryrefslogtreecommitdiff
path: root/src/managers
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2025-12-20 19:12:59 +0000
committerVaxry <vaxry@vaxry.net>2025-12-20 19:13:04 +0000
commit70f54a1e1ba3478a56faf82431b2770bd727431d (patch)
tree6862a6085b6a7bb5a1ab00f6ea1a25985cd0826e /src/managers
parentf6c5c659a7f95d135afc5c84b26f546548ca32bc (diff)
animationmgr: avoid possible uaf in handling anim updates
Diffstat (limited to 'src/managers')
-rw-r--r--src/managers/animation/AnimationManager.cpp52
1 files changed, 28 insertions, 24 deletions
diff --git a/src/managers/animation/AnimationManager.cpp b/src/managers/animation/AnimationManager.cpp
index b4255a33..9a3fc157 100644
--- a/src/managers/animation/AnimationManager.cpp
+++ b/src/managers/animation/AnimationManager.cpp
@@ -209,30 +209,34 @@ void CHyprAnimationManager::tick() {
static auto PANIMENABLED = CConfigValue<Hyprlang::INT>("animations:enabled");
- for (const auto& PAV : m_vActiveAnimatedVariables) {
- if (!PAV)
- continue;
-
- // for disabled anims just warp
- bool warp = !*PANIMENABLED || !PAV->enabled();
-
- switch (PAV->m_Type) {
- case AVARTYPE_FLOAT: {
- auto pTypedAV = dc<CAnimatedVariable<float>*>(PAV.get());
- RASSERT(pTypedAV, "Failed to upcast animated float");
- handleUpdate(*pTypedAV, warp);
- } break;
- case AVARTYPE_VECTOR: {
- auto pTypedAV = dc<CAnimatedVariable<Vector2D>*>(PAV.get());
- RASSERT(pTypedAV, "Failed to upcast animated Vector2D");
- handleUpdate(*pTypedAV, warp);
- } break;
- case AVARTYPE_COLOR: {
- auto pTypedAV = dc<CAnimatedVariable<CHyprColor>*>(PAV.get());
- RASSERT(pTypedAV, "Failed to upcast animated CHyprColor");
- handleUpdate(*pTypedAV, warp);
- } break;
- default: UNREACHABLE();
+ if (!m_vActiveAnimatedVariables.empty()) {
+ const auto CPY = m_vActiveAnimatedVariables;
+
+ for (const auto& PAV : CPY) {
+ if (!PAV)
+ continue;
+
+ // for disabled anims just warp
+ bool warp = !*PANIMENABLED || !PAV->enabled();
+
+ switch (PAV->m_Type) {
+ case AVARTYPE_FLOAT: {
+ auto pTypedAV = dc<CAnimatedVariable<float>*>(PAV.get());
+ RASSERT(pTypedAV, "Failed to upcast animated float");
+ handleUpdate(*pTypedAV, warp);
+ } break;
+ case AVARTYPE_VECTOR: {
+ auto pTypedAV = dc<CAnimatedVariable<Vector2D>*>(PAV.get());
+ RASSERT(pTypedAV, "Failed to upcast animated Vector2D");
+ handleUpdate(*pTypedAV, warp);
+ } break;
+ case AVARTYPE_COLOR: {
+ auto pTypedAV = dc<CAnimatedVariable<CHyprColor>*>(PAV.get());
+ RASSERT(pTypedAV, "Failed to upcast animated CHyprColor");
+ handleUpdate(*pTypedAV, warp);
+ } break;
+ default: UNREACHABLE();
+ }
}
}