plugins/slidingpopups: Always ref window when sliding it offscreen

Imagine the following case:

- the window is hidden, slideOut() is called but no deleted reference is
  created because the window is not deleted
- the window is closed, slideOut() won't be called because the window is
  hidden and SlidingPopupsEffect::slotWindowClosed() ignores closed windows
  that are already hidden
- the window is deleted in meanwhile
- the sliding popups effects attempt to delete m_animations[w] entry,
  but since "w" is a dangling pointer at this point, visibleRef is going
  to access released memory

To fix that, make slideOut() always ref the window.
This commit is contained in:
Vlad Zahorodnii 2024-02-05 15:07:15 +02:00
parent 69f344a439
commit 0c03e7ccfc

View file

@ -553,9 +553,7 @@ void SlidingPopupsEffect::slideOut(EffectWindow *w)
}
Animation &animation = m_animations[w];
if (w->isDeleted()) {
animation.deletedRef = EffectWindowDeletedRef(w);
}
animation.visibleRef = EffectWindowVisibleRef(w, EffectWindow::PAINT_DISABLED);
animation.kind = AnimationKind::Out;
animation.timeLine.setDirection(TimeLine::Backward);