plug a bunch of memory leaks

svn path=/trunk/KDE/kdebase/workspace/lib/plasma/; revision=672687
This commit is contained in:
Aaron J. Seigo 2007-06-07 20:57:18 +00:00
parent e90845573e
commit 58277a7608
6 changed files with 26 additions and 14 deletions

View File

@ -56,6 +56,15 @@ public:
engineExplorerAction(0) engineExplorerAction(0)
{ {
} }
~Private()
{
delete layout;
while (!applets.isEmpty()) {
delete applets.takeFirst();
}
}
bool immutable; bool immutable;
Applet::List applets; Applet::List applets;
FormFactor formFactor; FormFactor formFactor;
@ -112,9 +121,7 @@ void Corona::init()
Corona::~Corona() Corona::~Corona()
{ {
while (!d->applets.isEmpty()) { delete d;
delete d->applets.takeFirst();
}
} }
Location Corona::location() const Location Corona::location() const

View File

@ -39,25 +39,29 @@ class DataEngineManager::Private
{ {
public: public:
Private() Private()
: null(0) : nullEng(0)
{} {}
~Private() ~Private()
{ {
delete null; foreach (Plasma::DataEngine* engine, m_engines) {
delete engine;
}
m_engines.clear();
delete nullEng;
} }
DataEngine* nullEngine() DataEngine* nullEngine()
{ {
if (!null) { if (!nullEng) {
null = new NullEngine; nullEng = new NullEngine;
} }
return null; return nullEng;
} }
DataEngine::Dict m_engines; DataEngine::Dict m_engines;
DataEngine* null; DataEngine* nullEng;
}; };
class DataEngineManagerSingleton class DataEngineManagerSingleton
@ -80,10 +84,7 @@ DataEngineManager::DataEngineManager()
DataEngineManager::~DataEngineManager() DataEngineManager::~DataEngineManager()
{ {
foreach (Plasma::DataEngine* engine, d->m_engines) { delete d;
delete engine;
}
d->m_engines.clear();
} }
Plasma::DataEngine* DataEngineManager::dataEngine(const QString& name) const Plasma::DataEngine* DataEngineManager::dataEngine(const QString& name) const

View File

@ -191,7 +191,7 @@ Svg::Svg(const QString& imagePath, QObject* parent)
Svg::~Svg() Svg::~Svg()
{ {
delete d;
} }
void Svg::paint(QPainter* painter, const QPointF& point, const QString& elementID) void Svg::paint(QPainter* painter, const QPointF& point, const QString& elementID)

View File

@ -60,6 +60,7 @@ Theme::Theme(QObject* parent)
Theme::~Theme() Theme::~Theme()
{ {
delete d;
} }
QString Theme::themeName() const QString Theme::themeName() const

View File

@ -37,6 +37,7 @@ LineEdit::LineEdit(QGraphicsItem *parent, QGraphicsScene *scene)
LineEdit::~LineEdit() LineEdit::~LineEdit()
{ {
delete d;
} }
void LineEdit::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) void LineEdit::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)

View File

@ -47,6 +47,8 @@ VBoxLayout::~VBoxLayout()
foreach (LayoutItem *l, d->childList) { foreach (LayoutItem *l, d->childList) {
l->resetLayout(); l->resetLayout();
} }
delete d;
} }
Qt::Orientations VBoxLayout::expandingDirections() const Qt::Orientations VBoxLayout::expandingDirections() const