SVN commit 1143845 by mart:

avoid a crash in the following scenario: change the activity type of a 
containment, then try to stop the activity.
it still misbehaves, because the new containment it gets created is not added 
to the activity and the activity manager, that will list the activity as 
stopped.
this should be backported, but it has to be "right" before :)
CCMAIL:plasma-devel@kde.org


 M  +16 -0     activity.cpp  
 M  +1 -0      activity.h  


--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/activity.cpp 
#1143844:1143845
@@ -315,8 +315,24 @@
     connect(context, SIGNAL(activityChanged(Plasma::Context*)), this, 
SLOT(updateActivityName(Plasma::Context*)), Qt::UniqueConnection);
 
     m_containments.insert(QPair<int,int>(screen, desktop), containment);
+    connect(containment, SIGNAL(destroyed(QObject *)), this, 
SLOT(containmentDestroyed(QObject *)));
 }
 
+void Activity::containmentDestroyed(QObject *object)
+{
+    //safe here because we are not accessing it
+    Plasma::Containment *deletedCont = static_cast<Plasma::Containment 
*>(object);
+
+    QHash<QPair<int,int>, Plasma::Containment*>::iterator i;
+    for (i = m_containments.begin(); i != m_containments.end(); ++i) {
+        Plasma::Containment *cont = i.value();
+        if (cont == deletedCont) {
+            m_containments.remove(i.key());
+            break;
+        }
+    }
+}
+
 void Activity::open()
 {
     QString fileName = "activities/";
--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/activity.h #1143844:1143845
@@ -112,6 +112,7 @@
 
 private slots:
     void updateActivityName(Plasma::Context *context);
+    void containmentDestroyed(QObject *object);
 
 private:
     void activateContainment(int screen, int desktop);
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to