From kde-panel-devel Sun Oct 26 02:30:28 2008 From: Ambroz Bizjak Date: Sun, 26 Oct 2008 02:30:28 +0000 To: kde-panel-devel Subject: Re: crashes in DesktopLayout Message-Id: <200810260330.28573.ambro () b4ever ! net> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=122498826903420 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_EZ9AJOF+muId56O" --Boundary-00=_EZ9AJOF+muId56O Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. --Boundary-00=_EZ9AJOF+muId56O Content-Type: text/x-patch; charset="utf-8"; name="plasma-crash2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="plasma-crash2.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(layoutItem))) { + if (m_activated || m_animatingItems.contains(dynamic_cast(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 --Boundary-00=_EZ9AJOF+muId56O Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel --Boundary-00=_EZ9AJOF+muId56O--