[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: crashes in DesktopLayout
From:       Ambroz Bizjak <ambro () b4ever ! net>
Date:       2008-10-26 2:30:28
Message-ID: 200810260330.28573.ambro () b4ever ! net
[Download RAW message or body]

On Sunday 26 October 2008 01:33:05 Aaron J. Seigo wrote:
> hi Abroz...
>
> i've started getting a crash on-startup in DesktopLayout:

I can reproduce the crash with your config.

When the layout is activated, DesktopLayout::setGeometry is called. It calls 
ItemSpace to calculates pushes, and then applies new geometries to applets. As 
an applet is assigned a new geometry, DesktopLayout::itemGeometryChanged 
naturally gets called before the applet's setGeometry function returns. While 
itemGeometryChanged should do nothing in this case (the layout is being 
activated), is really continues and modifies the layout's structures, causing 
that crash during the iteration.

Apparently QGraphicsLayout::isActivated is lying. I'm attaching a patch that 
adds a variable to make sure nothing is changed while the layout is being 
activated, and I'll commit it, but it's a hack. We really should analyze what 
is causing that behaviour.

["plasma-crash2.patch" (text/x-patch)]

Index: workspace/plasma/containments/desktop/desktoplayout.cpp
===================================================================
--- workspace/plasma/containments/desktop/desktoplayout.cpp	(revision 875926)
+++ workspace/plasma/containments/desktop/desktoplayout.cpp	(working copy)
@@ -25,7 +25,8 @@
         QGraphicsLayout(parent),
         autoWorkingArea(true),
         temporaryPlacement(false),
-        visibilityTolerance(0)
+        visibilityTolerance(0),
+        m_activated(false)
 {
     connect(Plasma::Animator::self(), SIGNAL(movementFinished(QGraphicsItem*)),
             this, SLOT(movementFinished(QGraphicsItem*)));
@@ -251,6 +252,7 @@
 // update anything that needs updating
 void DesktopLayout::setGeometry(const QRectF &rect)
 {
+    m_activated = true;
     QGraphicsLayout::setGeometry(rect);
 
     if (autoWorkingArea || !itemSpace.workingGeom.isValid()) {
@@ -301,13 +303,14 @@
             }
         }
     }
+    m_activated = false;
 }
 
 // This should be called when the geometry of an item has been changed.
 // If the change was made by the user, the new position is used as the preferred position.
 void DesktopLayout::itemGeometryChanged(QGraphicsLayoutItem *layoutItem)
 {
-    if (isActivated() || m_animatingItems.contains(dynamic_cast<QGraphicsWidget*>(layoutItem))) {
+    if (m_activated || m_animatingItems.contains(dynamic_cast<QGraphicsWidget*>(layoutItem))) {
         return;
     }
 
Index: workspace/plasma/containments/desktop/desktoplayout.h
===================================================================
--- workspace/plasma/containments/desktop/desktoplayout.h	(revision 875926)
+++ workspace/plasma/containments/desktop/desktoplayout.h	(working copy)
@@ -159,6 +159,8 @@
     // item manipulation functions
     void performTemporaryPlacement(int group, int itemInGroup);
     void revertTemporaryPlacement(int group, int itemInGroup);
+
+    bool m_activated;
 };
 
 #endif


_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic