diff options
authorMarco Martin <>2017-01-10 14:27:14 (GMT)
committerMarco Martin <>2017-01-10 15:06:45 (GMT)
commit19a88030d3de12a96402a1103c964e5a7363646c (patch)
parentcf6d8ab0dff2a6ba29574636ccfbe23c7917c48f (diff)
better clean up of duplicate containments
Summary: due to old multiscreen bugs, sometimes the appletsrc file gets polluted with a lot of containments with same activity id and lastScreen, in some cases even hundreds (see in that case we can't be 100% sure what containment will be loaded at startup, leading to an herratical behavior. it was trying to clean up duplicates but wasn't really effective now base upon lastScreen (so we catch other activities as well) and manually remove the destroyed containment from m_desktopContainments (which may sole some multiscreen related bug, such as 371991) BUG:371858 CCBUG:371991 Test Plan: started a session with the corrupted appletsrc from the bugreport, file gets cleaned out of duplicates Reviewers: davidedmundson, #plasma Reviewed By: davidedmundson, #plasma Subscribers: davidedmundson, plasma-devel Tags: #plasma Differential Revision:
1 files changed, 4 insertions, 4 deletions
diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp
index dd281c9..1337523 100644
--- a/shell/shellcorona.cpp
+++ b/shell/shellcorona.cpp
@@ -1896,7 +1896,8 @@ void ShellCorona::insertContainment(const QString &activity, int screenNum, Plas
Plasma::Containment *cont = nullptr;
for (Plasma::Containment *c : m_desktopContainments.value(activity)) {
- if (c->screen() == screenNum) {
+ //using lastScreen() instead of screen() catches also containments of activities that aren't the current one, so not assigned to a screen right now
+ if (c->lastScreen() == screenNum) {
cont = c;
if (containment == cont) {
@@ -1908,8 +1909,6 @@ void ShellCorona::insertContainment(const QString &activity, int screenNum, Plas
if (cont) {
- disconnect(cont, SIGNAL(destroyed(QObject*)),
- this, SLOT(desktopContainmentDestroyed(QObject*)));
@@ -1924,7 +1923,8 @@ void ShellCorona::desktopContainmentDestroyed(QObject *obj)
// members of Containment are not accessible anymore,
// so keep ugly bookeeping by hand
auto containment = static_cast<Plasma::Containment*>(obj);
- for (auto a : m_desktopContainments) {
+ //explicitly specify the range by reference, as we need to remove stuff from the sets
+ for (QSet<Plasma::Containment *> &a : m_desktopContainments) {
QMutableSetIterator<Plasma::Containment *> it(a);
while (it.hasNext()) {;