effects/slidingpopups: Prevent potential use-after-free

This commit is contained in:
Vlad Zahorodnii 2023-03-04 12:04:27 +02:00
parent 58ac7888e9
commit cdd18cd393

View file

@ -186,6 +186,7 @@ void SlidingPopupsEffect::postPaintWindow(EffectWindow *w)
{ {
auto animationIt = m_animations.find(w); auto animationIt = m_animations.find(w);
if (animationIt != m_animations.end()) { if (animationIt != m_animations.end()) {
effects->addRepaint(w->expandedGeometry());
if ((*animationIt).timeLine.done()) { if ((*animationIt).timeLine.done()) {
if (!w->isDeleted()) { if (!w->isDeleted()) {
w->setData(WindowForceBackgroundContrastRole, QVariant()); w->setData(WindowForceBackgroundContrastRole, QVariant());
@ -193,7 +194,6 @@ void SlidingPopupsEffect::postPaintWindow(EffectWindow *w)
} }
m_animations.erase(animationIt); m_animations.erase(animationIt);
} }
effects->addRepaint(w->expandedGeometry());
} }
effects->postPaintWindow(w); effects->postPaintWindow(w);