tired of the "expect crashes" output all the time, i just fixed it properly by deleting the existing layout. since the layout makes itself the parent of the child layout and already deletes it in the dtor, this only makes sense. hello greater safety and goodbye scary console output ;)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=771686
This commit is contained in:
Aaron J. Seigo 2008-02-06 18:16:11 +00:00
parent fb7e6541ad
commit 3af4b66dca
6 changed files with 18 additions and 11 deletions

View File

@ -56,6 +56,10 @@ BorderLayout::BorderLayout(LayoutItem * parent) :
BorderLayout::~BorderLayout()
{
foreach (Plasma::LayoutItem *item, d->itemPositions) {
item->unsetManagingLayout(this);
}
delete d;
}

View File

@ -47,6 +47,10 @@ FlowLayout::FlowLayout(LayoutItem* parent)
}
FlowLayout::~FlowLayout()
{
foreach (LayoutItem *item, d->items) {
item->unsetManagingLayout(this);
}
delete d;
}

View File

@ -41,6 +41,10 @@ FreeLayout::FreeLayout(LayoutItem *parent)
FreeLayout::~FreeLayout()
{
foreach (LayoutItem *item, d->children) {
item->unsetManagingLayout(this);
}
delete d;
}

View File

@ -168,7 +168,7 @@ class PLASMA_EXPORT Layout : public LayoutItem
virtual QSizeF maximumSize() const;
/** TODO Document me */
void invalidate();
void invalidate();
protected:
/**

View File

@ -87,19 +87,10 @@ qreal LayoutItem::widthForHeight(qreal h) const
void LayoutItem::setLayout(Layout* layout)
{
if (d->layout && layout) {
kDebug() << "already have a layout.";
return;
}
delete d->layout;
if (layout) {
layout->setParent(this);
} else if (d->layout) {
// 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";
}
d->layout = layout;

View File

@ -159,6 +159,10 @@ NodeLayout::NodeLayout(LayoutItem * parent)
NodeLayout::~NodeLayout()
{
foreach (LayoutItem * item, d->items.keys()) {
item->unsetManagingLayout(this);
}
delete d;
}