forked from qt-creator/qt-creator
Debugger/various plugins: Fix memory leaks.
Reviewed-by: hjk <qtc-committer@nokia.com> Reviewed-by: dt <qtc-committer@nokia.com>
This commit is contained in:
@@ -68,6 +68,7 @@ CodepasterPlugin::CodepasterPlugin()
|
|||||||
|
|
||||||
CodepasterPlugin::~CodepasterPlugin()
|
CodepasterPlugin::~CodepasterPlugin()
|
||||||
{
|
{
|
||||||
|
qDeleteAll(m_protocols);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_message)
|
bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_message)
|
||||||
|
|||||||
@@ -195,6 +195,8 @@ DisassemblerViewAgent::~DisassemblerViewAgent()
|
|||||||
if (d->editor)
|
if (d->editor)
|
||||||
d->editor->deleteLater();
|
d->editor->deleteLater();
|
||||||
d->editor = 0;
|
d->editor = 0;
|
||||||
|
delete d->locationMark;
|
||||||
|
d->locationMark = 0;
|
||||||
delete d;
|
delete d;
|
||||||
d = 0;
|
d = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QEvent>
|
#include <QtCore/QEvent>
|
||||||
|
|
||||||
#include <QtCore/QtAlgorithms>
|
#include <QtCore/QtAlgorithms>
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
@@ -361,6 +362,11 @@ WatchModel::WatchModel(WatchHandler *handler, WatchType type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WatchModel::~WatchModel()
|
||||||
|
{
|
||||||
|
delete m_root;
|
||||||
|
}
|
||||||
|
|
||||||
WatchItem *WatchModel::rootItem() const
|
WatchItem *WatchModel::rootItem() const
|
||||||
{
|
{
|
||||||
return m_root;
|
return m_root;
|
||||||
@@ -420,7 +426,7 @@ void WatchModel::removeOutdated()
|
|||||||
void WatchModel::removeOutdatedHelper(WatchItem *item)
|
void WatchModel::removeOutdatedHelper(WatchItem *item)
|
||||||
{
|
{
|
||||||
if (item->generation < generationCounter) {
|
if (item->generation < generationCounter) {
|
||||||
removeItem(item);
|
destroyItem(item);
|
||||||
} else {
|
} else {
|
||||||
foreach (WatchItem *child, item->children)
|
foreach (WatchItem *child, item->children)
|
||||||
removeOutdatedHelper(child);
|
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;
|
WatchItem *parent = item->parent;
|
||||||
QModelIndex index = watchIndex(parent);
|
QModelIndex index = watchIndex(parent);
|
||||||
@@ -437,6 +443,7 @@ void WatchModel::removeItem(WatchItem *item)
|
|||||||
beginRemoveRows(index, n, n);
|
beginRemoveRows(index, n, n);
|
||||||
parent->children.removeAt(n);
|
parent->children.removeAt(n);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
|
delete item;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString parentName(const QString &iname)
|
static QString parentName(const QString &iname)
|
||||||
@@ -1187,7 +1194,7 @@ void WatchHandler::removeData(const QString &iname)
|
|||||||
return;
|
return;
|
||||||
WatchItem *item = model->findItem(iname, model->m_root);
|
WatchItem *item = model->findItem(iname, model->m_root);
|
||||||
if (item)
|
if (item)
|
||||||
model->removeItem(item);
|
model->destroyItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::watchExpression()
|
void WatchHandler::watchExpression()
|
||||||
@@ -1302,7 +1309,7 @@ void WatchHandler::removeWatchExpression(const QString &exp)
|
|||||||
m_watcherNames.remove(exp);
|
m_watcherNames.remove(exp);
|
||||||
foreach (WatchItem *item, m_watchers->rootItem()->children) {
|
foreach (WatchItem *item, m_watchers->rootItem()->children) {
|
||||||
if (item->exp == exp) {
|
if (item->exp == exp) {
|
||||||
m_watchers->removeItem(item);
|
m_watchers->destroyItem(item);
|
||||||
saveWatchers();
|
saveWatchers();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ class WatchModel : public QAbstractItemModel
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
explicit WatchModel(WatchHandler *handler, WatchType type);
|
explicit WatchModel(WatchHandler *handler, WatchType type);
|
||||||
|
virtual ~WatchModel();
|
||||||
|
|
||||||
QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
||||||
@@ -209,7 +210,7 @@ private:
|
|||||||
void removeOutdated();
|
void removeOutdated();
|
||||||
void removeOutdatedHelper(WatchItem *item);
|
void removeOutdatedHelper(WatchItem *item);
|
||||||
WatchItem *rootItem() const;
|
WatchItem *rootItem() const;
|
||||||
void removeItem(WatchItem *item);
|
void destroyItem(WatchItem *item);
|
||||||
|
|
||||||
void emitDataChanged(int column,
|
void emitDataChanged(int column,
|
||||||
const QModelIndex &parentIndex = QModelIndex());
|
const QModelIndex &parentIndex = QModelIndex());
|
||||||
|
|||||||
@@ -35,18 +35,24 @@ namespace Internal {
|
|||||||
|
|
||||||
struct ProjectExplorerSettings
|
struct ProjectExplorerSettings
|
||||||
{
|
{
|
||||||
|
ProjectExplorerSettings() : buildBeforeRun(true), saveBeforeBuild(false),
|
||||||
|
showCompilerOutput(false), useJom(true) {}
|
||||||
|
|
||||||
bool buildBeforeRun;
|
bool buildBeforeRun;
|
||||||
bool saveBeforeBuild;
|
bool saveBeforeBuild;
|
||||||
bool showCompilerOutput;
|
bool showCompilerOutput;
|
||||||
bool useJom;
|
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 ProjectExplorer
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
|
|||||||
@@ -132,8 +132,10 @@ S60Manager::S60Manager(QObject *parent)
|
|||||||
S60Manager::~S60Manager()
|
S60Manager::~S60Manager()
|
||||||
{
|
{
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
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));
|
pm->removeObject(m_pluginObjects.at(i));
|
||||||
|
delete m_pluginObjects.at(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S60Manager::addAutoReleasedObject(QObject *o)
|
void S60Manager::addAutoReleasedObject(QObject *o)
|
||||||
|
|||||||
Reference in New Issue
Block a user