[wayland] avoid potential crash when checking for window inhibitions on desktop change

Summary:
Xwayland clients are sometimes offset from being visible to having a
surface applied.

We might also have internal windows which will be AbstractClients
without a surface.

No idle interface will be set up for non wayland clients, but on a
desktop change we itterate through all AbstractClients and need to guard
somewhere.

BUG: 420039

Test Plan: None

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28858
master
David Edmundson 2020-04-16 00:57:50 +01:00
parent bee3afdd51
commit d0875aa117
1 changed files with 1 additions and 1 deletions

View File

@ -101,7 +101,7 @@ void IdleInhibition::update(AbstractClient *client)
// TODO: Don't honor the idle inhibitor object if the shell client is not
// on the current activity (currently, activities are not supported).
const bool visible = client->isShown(true) && client->isOnCurrentDesktop();
if (visible && client->surface()->inhibitsIdle()) {
if (visible && client->surface() && client->surface()->inhibitsIdle()) {
inhibit(client);
} else {
uninhibit(client);