Cleanup virutal desktops in deleted

Summary:
virtual desktops can be destroyed, active clients update, but deleted
keeps a cache.

Someone needs to do cleanup to avoid dangly pointers.

Test Plan:
I couldn't find a case of someone calling desktops mid way through an
animation, so it's only a hypothetical bug.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: graesslin, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17247
icc-effect-5.17.5
David Edmundson 2019-01-10 17:32:40 +00:00
parent 14b827daaa
commit b55d276994
1 changed files with 6 additions and 0 deletions

View File

@ -141,6 +141,12 @@ void Deleted::copyToDeleted(Toplevel* c)
m_wasGroupTransient = x11Client && x11Client->groupTransient();
}
for (auto vd : m_desktops) {
connect(vd, &QObject::destroyed, this, [=] {
m_desktops.removeOne(vd);
});
}
m_wasWaylandClient = qobject_cast<ShellClient *>(c) != nullptr;
m_wasX11Client = !m_wasWaylandClient;
m_wasPopupWindow = c->isPopupWindow();