animation: avoid crashes in ::tick() on mutations

mutating the active variables is valid during a tick, we can't let it crash
This commit is contained in:
Vaxry 2025-01-10 21:55:19 +01:00
parent a8b568c6c4
commit cef09fbfe6

View file

@ -215,7 +215,11 @@ void CHyprAnimationManager::tick() {
lastTick = std::chrono::high_resolution_clock::now(); lastTick = std::chrono::high_resolution_clock::now();
static auto PANIMENABLED = CConfigValue<Hyprlang::INT>("animations:enabled"); static auto PANIMENABLED = CConfigValue<Hyprlang::INT>("animations:enabled");
for (auto const& pav : m_vActiveAnimatedVariables) {
// We need to do this because it's perfectly valid to add/change a var during this (via callbacks)
// FIXME: instead of doing this, make a fn to defer adding until tick is done and not in progress anymore.
const auto PAVS = m_vActiveAnimatedVariables;
for (auto const& pav : PAVS) {
const auto PAV = pav.lock(); const auto PAV = pav.lock();
if (!PAV) if (!PAV)
continue; continue;