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:
parent
fb7e6541ad
commit
3af4b66dca
@ -56,6 +56,10 @@ BorderLayout::BorderLayout(LayoutItem * parent) :
|
||||
|
||||
BorderLayout::~BorderLayout()
|
||||
{
|
||||
foreach (Plasma::LayoutItem *item, d->itemPositions) {
|
||||
item->unsetManagingLayout(this);
|
||||
}
|
||||
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,10 @@ FlowLayout::FlowLayout(LayoutItem* parent)
|
||||
}
|
||||
FlowLayout::~FlowLayout()
|
||||
{
|
||||
foreach (LayoutItem *item, d->items) {
|
||||
item->unsetManagingLayout(this);
|
||||
}
|
||||
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,10 @@ FreeLayout::FreeLayout(LayoutItem *parent)
|
||||
|
||||
FreeLayout::~FreeLayout()
|
||||
{
|
||||
foreach (LayoutItem *item, d->children) {
|
||||
item->unsetManagingLayout(this);
|
||||
}
|
||||
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ class PLASMA_EXPORT Layout : public LayoutItem
|
||||
virtual QSizeF maximumSize() const;
|
||||
|
||||
/** TODO Document me */
|
||||
void invalidate();
|
||||
void invalidate();
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -159,6 +159,10 @@ NodeLayout::NodeLayout(LayoutItem * parent)
|
||||
|
||||
NodeLayout::~NodeLayout()
|
||||
{
|
||||
foreach (LayoutItem * item, d->items.keys()) {
|
||||
item->unsetManagingLayout(this);
|
||||
}
|
||||
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user