[effects/slidingpopups] Don't crash when sliding virtual desktops
ClosedPublic

Authored by zzag on Nov 7 2018, 10:45 AM.

Details

Summary

If you switch virtual desktops while krunner is sliding in, then
depending on whether your distro strips assert statements away,
KWin can crash.

The reason why it crashes is the sliding popups effect tries to unref
deleted windows that it hasn't referenced before (if there is an active
full screen effect, then popups won't be slided out, which in its turn
means that we won't reference deleted windows). So, in the end, the
refcount of those windows can be -1. That triggers an assert statement
in the destructor of the Deleted class, which checks whether the
refcount is equal to 0.

Popups are not slided while there is an active full screen effect because
we don't know what the full screen effect does.

This patch adjusts the sliding popups effect so it stops all active
animations when user switches virtual desktops or when a full screen
effect kicks in. We need to do that so the effect won't try to
unreference windows in postPaintWindow.

Visually, it doesn't look quite nice, but for now that's good enough.
A proper fix would be more complex: we would need to make sure that
full screen effects ignore sliding popups (and also maybe docks) and
perform some input redirection.

BUG: 400170
FIXED-IN: 5.14.4

Test Plan

I'm not able anymore to reproduce bug 400170.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Nov 7 2018, 10:45 AM
Restricted Application added a project: KWin. · View Herald TranscriptNov 7 2018, 10:45 AM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Nov 7 2018, 10:45 AM
graesslin added inline comments.
effects/slidingpopups/slidingpopups.cpp
445

I would use either an iterator based for-loop here or just:
for (auto animationIt: m_animations)

(if there is an active
full screen effect, then popups won't be slided out, which in its turn
means that we won't reference deleted windows).

So how does it end up in m_animations?

zzag updated this revision to Diff 45027.Nov 7 2018, 12:23 PM

Use for loop

zzag added a comment.EditedNov 7 2018, 12:27 PM

So how does it end up in m_animations?

  • Set animation speed to "Very slow"
  • Open KRunner (by pressing alt + space, for example)
  • While it's [krunner] sliding in, switch to another virtual desktop
zzag added a comment.Nov 7 2018, 1:04 PM

Set animation speed to "Very slow"

BTW, you don't really need to do that. That's just to make it easier to spot a good moment when to trigger a full screen effect.

graesslin accepted this revision.Nov 7 2018, 2:38 PM
This revision is now accepted and ready to land.Nov 7 2018, 2:38 PM
This revision was automatically updated to reflect the committed changes.