Validate activities in setOnActivities

Summary:
This fixes a bug I had where Session Management restored a window on an
activity that didn't exist that, meaning I was unable to access it.

setOnActivity() already has this check

BUG: 362620

Test Plan:
Using my broken session, restored and got my ghost process back
on all activities

Added a window to activity 2, checked it came back there and
only there.

Reviewers: #plasma, graesslin

Subscribers: ivan, luebking, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D1982
This commit is contained in:
David Edmundson 2016-08-12 12:25:33 +01:00
parent b14618994b
commit 0dd927c4a4

View file

@ -1240,6 +1240,16 @@ void Client::setOnActivities(QStringList newActivitiesList)
newActivitiesList = joinedActivitiesList.split(u',', QString::SkipEmptyParts);
QStringList allActivities = Activities::self()->all();
auto it = newActivitiesList.begin();
while (it != newActivitiesList.end()) {
if (! allActivities.contains(*it)) {
it = newActivitiesList.erase(it);
} else {
it++;
}
}
if (// If we got the request to be on all activities explicitly
newActivitiesList.isEmpty() || joinedActivitiesList == Activities::nullUuid() ||
// If we got a list of activities that covers all activities