animationmgr: avoid possible uaf in handling anim updates
This commit is contained in:
parent
f6c5c659a7
commit
70f54a1e1b
1 changed files with 26 additions and 22 deletions
|
|
@ -209,30 +209,34 @@ void CHyprAnimationManager::tick() {
|
||||||
|
|
||||||
static auto PANIMENABLED = CConfigValue<Hyprlang::INT>("animations:enabled");
|
static auto PANIMENABLED = CConfigValue<Hyprlang::INT>("animations:enabled");
|
||||||
|
|
||||||
for (const auto& PAV : m_vActiveAnimatedVariables) {
|
if (!m_vActiveAnimatedVariables.empty()) {
|
||||||
if (!PAV)
|
const auto CPY = m_vActiveAnimatedVariables;
|
||||||
continue;
|
|
||||||
|
|
||||||
// for disabled anims just warp
|
for (const auto& PAV : CPY) {
|
||||||
bool warp = !*PANIMENABLED || !PAV->enabled();
|
if (!PAV)
|
||||||
|
continue;
|
||||||
|
|
||||||
switch (PAV->m_Type) {
|
// for disabled anims just warp
|
||||||
case AVARTYPE_FLOAT: {
|
bool warp = !*PANIMENABLED || !PAV->enabled();
|
||||||
auto pTypedAV = dc<CAnimatedVariable<float>*>(PAV.get());
|
|
||||||
RASSERT(pTypedAV, "Failed to upcast animated float");
|
switch (PAV->m_Type) {
|
||||||
handleUpdate(*pTypedAV, warp);
|
case AVARTYPE_FLOAT: {
|
||||||
} break;
|
auto pTypedAV = dc<CAnimatedVariable<float>*>(PAV.get());
|
||||||
case AVARTYPE_VECTOR: {
|
RASSERT(pTypedAV, "Failed to upcast animated float");
|
||||||
auto pTypedAV = dc<CAnimatedVariable<Vector2D>*>(PAV.get());
|
handleUpdate(*pTypedAV, warp);
|
||||||
RASSERT(pTypedAV, "Failed to upcast animated Vector2D");
|
} break;
|
||||||
handleUpdate(*pTypedAV, warp);
|
case AVARTYPE_VECTOR: {
|
||||||
} break;
|
auto pTypedAV = dc<CAnimatedVariable<Vector2D>*>(PAV.get());
|
||||||
case AVARTYPE_COLOR: {
|
RASSERT(pTypedAV, "Failed to upcast animated Vector2D");
|
||||||
auto pTypedAV = dc<CAnimatedVariable<CHyprColor>*>(PAV.get());
|
handleUpdate(*pTypedAV, warp);
|
||||||
RASSERT(pTypedAV, "Failed to upcast animated CHyprColor");
|
} break;
|
||||||
handleUpdate(*pTypedAV, warp);
|
case AVARTYPE_COLOR: {
|
||||||
} break;
|
auto pTypedAV = dc<CAnimatedVariable<CHyprColor>*>(PAV.get());
|
||||||
default: UNREACHABLE();
|
RASSERT(pTypedAV, "Failed to upcast animated CHyprColor");
|
||||||
|
handleUpdate(*pTypedAV, warp);
|
||||||
|
} break;
|
||||||
|
default: UNREACHABLE();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue