Avoid potential assert in SM saving

Summary:
Sesison Manager stores all relevant clients. There's an assert if the
window type is outside of the standard client window types. It assumed
that all windows outside this would be Unmanaged windows rather than
Client objects, something probably true but not something enforced.

This particular crash was probably cased as we have a new window type in
Plasma OSD, which does not set BypassWindowManager in Qt window flags.

BUG: 395712

Test Plan:
Set to restore session
Logged out and back in
Saw some windows

Set to restore manually saved session
Hit save
No crash

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13715
This commit is contained in:
David Edmundson 2018-06-27 01:36:02 +01:00
parent 81ac47a6a8
commit 2693e288c5

8
sm.cpp
View file

@ -108,6 +108,11 @@ void Workspace::storeSession(KConfig* config, SMSavePhase phase)
for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) {
Client* c = (*it);
if (c->windowType() > NET::Splash) {
//window types outside this are not tooltips/menus/OSDs
//typically these will be unmanaged and not in this list anyway, but that is not enforced
continue;
}
QByteArray sessionId = c->sessionId();
QByteArray wmCommand = c->wmCommand();
if (sessionId.isEmpty())
@ -184,6 +189,9 @@ void Workspace::storeSubSession(const QString &name, QSet<QByteArray> sessionIds
int active_client = -1;
for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) {
Client* c = (*it);
if (c->windowType() > NET::Splash) {
continue;
}
QByteArray sessionId = c->sessionId();
QByteArray wmCommand = c->wmCommand();
if (sessionId.isEmpty())