Diffusion KWin bd158a632100

Reset last_active_client when a ShellClient is removed

Authored by graesslin on Jul 23 2017, 2:18 PM.

Description

Reset last_active_client when a ShellClient is removed

Summary:
The last_active_client is set when an AbstractClient gets activated. For
the X11 case the last_active_client was getting reset to nullptr when
the last_active_client gets destroyed. But for the ShellClient that did
not yet happen. This could result in a crash.

This change addresses the problem and adds a test case which triggered
the crash. The condition of the crash are difficult to generate though -
it took me about an hour to write the test for the crash.

  1. Wayland client must be active
  2. Explicit focus to null (no active client)
  3. destroy Wayland window
  4. X11 client which sets focus on itself without interaction with window manager

Test Plan: test case no longer crashes

Reviewers: KWin, Plasma

Subscribers: plasma-devel, kwin

Tags: KWin

Differential Revision: https://phabricator.kde.org/D6852