Commit f4943f3c authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger/various plugins: Fix memory leaks.


Reviewed-by: default avatarhjk <qtc-committer@nokia.com>
Reviewed-by: default avatardt <qtc-committer@nokia.com>
parent a7d0fb80
......@@ -68,6 +68,7 @@ CodepasterPlugin::CodepasterPlugin()
CodepasterPlugin::~CodepasterPlugin()
{
qDeleteAll(m_protocols);
}
bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_message)
......
......@@ -195,6 +195,8 @@ DisassemblerViewAgent::~DisassemblerViewAgent()
if (d->editor)
d->editor->deleteLater();
d->editor = 0;
delete d->locationMark;
d->locationMark = 0;
delete d;
d = 0;
}
......
......@@ -41,6 +41,7 @@
#include <QtCore/QDebug>
#include <QtCore/QEvent>
#include <QtCore/QtAlgorithms>
#include <QtCore/QTextStream>
#include <QtCore/QTimer>
......@@ -361,6 +362,11 @@ WatchModel::WatchModel(WatchHandler *handler, WatchType type)
}
}
WatchModel::~WatchModel()
{
delete m_root;
}
WatchItem *WatchModel::rootItem() const
{
return m_root;
......@@ -420,7 +426,7 @@ void WatchModel::removeOutdated()
void WatchModel::removeOutdatedHelper(WatchItem *item)
{
if (item->generation < generationCounter) {
removeItem(item);
destroyItem(item);
} else {
foreach (WatchItem *child, item->children)
removeOutdatedHelper(child);
......@@ -428,7 +434,7 @@ void WatchModel::removeOutdatedHelper(WatchItem *item)
}
}
void WatchModel::removeItem(WatchItem *item)
void WatchModel::destroyItem(WatchItem *item)
{
WatchItem *parent = item->parent;
QModelIndex index = watchIndex(parent);
......@@ -437,6 +443,7 @@ void WatchModel::removeItem(WatchItem *item)
beginRemoveRows(index, n, n);
parent->children.removeAt(n);
endRemoveRows();
delete item;
}
static QString parentName(const QString &iname)
......@@ -1187,7 +1194,7 @@ void WatchHandler::removeData(const QString &iname)
return;
WatchItem *item = model->findItem(iname, model->m_root);
if (item)
model->removeItem(item);
model->destroyItem(item);
}
void WatchHandler::watchExpression()
......@@ -1302,7 +1309,7 @@ void WatchHandler::removeWatchExpression(const QString &exp)
m_watcherNames.remove(exp);
foreach (WatchItem *item, m_watchers->rootItem()->children) {
if (item->exp == exp) {
m_watchers->removeItem(item);
m_watchers->destroyItem(item);
saveWatchers();
break;
}
......
......@@ -180,6 +180,7 @@ class WatchModel : public QAbstractItemModel
private:
explicit WatchModel(WatchHandler *handler, WatchType type);
virtual ~WatchModel();
QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
......@@ -209,7 +210,7 @@ private:
void removeOutdated();
void removeOutdatedHelper(WatchItem *item);
WatchItem *rootItem() const;
void removeItem(WatchItem *item);
void destroyItem(WatchItem *item);
void emitDataChanged(int column,
const QModelIndex &parentIndex = QModelIndex());
......
......@@ -35,18 +35,24 @@ namespace Internal {
struct ProjectExplorerSettings
{
ProjectExplorerSettings() : buildBeforeRun(true), saveBeforeBuild(false),
showCompilerOutput(false), useJom(true) {}
bool buildBeforeRun;
bool saveBeforeBuild;
bool showCompilerOutput;
bool useJom;
bool operator==(const ProjectExplorerSettings &other) const {
return this->buildBeforeRun == other.buildBeforeRun
&& this->saveBeforeBuild == other.saveBeforeBuild
&& this->showCompilerOutput == other.showCompilerOutput
&& this->useJom == other.useJom;
}
};
inline bool operator==(const ProjectExplorerSettings &p1, const ProjectExplorerSettings &p2)
{
return p1.buildBeforeRun == p2.buildBeforeRun
&& p1.saveBeforeBuild == p2.saveBeforeBuild
&& p1.showCompilerOutput == p2.showCompilerOutput
&& p1.useJom == p2.useJom;
}
} // namespace ProjectExplorer
} // namespace Internal
......
......@@ -132,8 +132,10 @@ S60Manager::S60Manager(QObject *parent)
S60Manager::~S60Manager()
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
for (int i = m_pluginObjects.size() - 1; i >= 0; i--)
for (int i = m_pluginObjects.size() - 1; i >= 0; i--) {
pm->removeObject(m_pluginObjects.at(i));
delete m_pluginObjects.at(i);
}
}
void S60Manager::addAutoReleasedObject(QObject *o)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment