prevent crashing on exit; layout must not be deleted before the applets which are managed by it.

this is a brittleness in the layout system that really needs to be addressed (and i added a comment and some debug output about this in LayoutItem)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=712164
This commit is contained in:
Aaron J. Seigo 2007-09-13 19:47:14 +00:00
parent d20c9a010f
commit 0fc83b6e76
2 changed files with 13 additions and 6 deletions

View File

@ -60,8 +60,8 @@ public:
~Private()
{
delete layout;
qDeleteAll(applets);
delete layout;
}
bool immutable;

View File

@ -63,22 +63,22 @@ QGraphicsItem* LayoutItem::graphicsItem()
bool LayoutItem::hasHeightForWidth() const
{
return false;
return false;
}
qreal LayoutItem::heightForWidth(qreal w) const
{
return 0.0;
return 0.0;
}
bool LayoutItem::hasWidthForHeight() const
{
return false;
return false;
}
qreal LayoutItem::widthForHeight(qreal h) const
{
return 0.0;
return 0.0;
}
void LayoutItem::setLayout(Layout* layout)
@ -90,8 +90,15 @@ void LayoutItem::setLayout(Layout* layout)
d->layout = layout;
if ( layout )
if (layout) {
layout->setParent(this);
} else {
// FIXME: we had a layout, but now it has been removed
// and we are without layout; we should tell our
// children about this, but LayoutItem doesn't know
// about children =/
kDebug() << "layout removed from under us. expect crashes";
}
}
Layout* LayoutItem::layout() const