guard against use of setParent
svn path=/trunk/KDE/kdelibs/; revision=1014484
This commit is contained in:
parent
f9317c11e6
commit
23c52d1e2d
@ -133,7 +133,7 @@ PackageStructure::Ptr ContainmentActions::packageStructure()
|
|||||||
|
|
||||||
Containment *ContainmentActions::containment()
|
Containment *ContainmentActions::containment()
|
||||||
{
|
{
|
||||||
return static_cast<Containment*>(parent());
|
return qobject_cast<Containment*>(parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ContainmentActions::name() const
|
QString ContainmentActions::name() const
|
||||||
@ -299,6 +299,17 @@ void ContainmentActions::paste(QPointF scenePos, QPoint screenPos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ContainmentActions::event(QEvent *e)
|
||||||
|
{
|
||||||
|
if (e->type() == QEvent::ParentChange) {
|
||||||
|
if (!containment()) {
|
||||||
|
//some fool took away our containment. run away, run away!
|
||||||
|
deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
#include "containmentactions.moc"
|
#include "containmentactions.moc"
|
||||||
|
@ -206,6 +206,8 @@ class PLASMA_EXPORT ContainmentActions : public QObject
|
|||||||
*/
|
*/
|
||||||
static QString eventToString(QEvent *event);
|
static QString eventToString(QEvent *event);
|
||||||
|
|
||||||
|
bool event(QEvent *e);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* This constructor is to be used with the plugin loading systems
|
* This constructor is to be used with the plugin loading systems
|
||||||
|
Loading…
x
Reference in New Issue
Block a user