Debugger: Delete pointer if no more needed

Introduced with 2b19081cb0

Change-Id: I817ec48b9098f46ca703a6075d4657f0b7eb9948
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Christian Stenger
2015-06-15 15:40:22 +02:00
committed by hjk
parent d92055dde4
commit 90656ea455
2 changed files with 4 additions and 4 deletions

View File

@@ -212,7 +212,7 @@ Modules ModulesHandler::modules() const
void ModulesHandler::removeModule(const QString &modulePath) void ModulesHandler::removeModule(const QString &modulePath)
{ {
if (ModuleItem *item = moduleFromPath(m_model->rootItem(), modulePath)) if (ModuleItem *item = moduleFromPath(m_model->rootItem(), modulePath))
m_model->takeItem(item); delete m_model->takeItem(item);
} }
void ModulesHandler::updateModule(const Module &module) void ModulesHandler::updateModule(const Module &module)
@@ -254,7 +254,7 @@ void ModulesHandler::endUpdateAll()
for (int i = root->rowCount(); --i >= 0; ) { for (int i = root->rowCount(); --i >= 0; ) {
auto item = static_cast<ModuleItem *>(root->child(i)); auto item = static_cast<ModuleItem *>(root->child(i));
if (!item->updated) if (!item->updated)
m_model->takeItem(item); delete m_model->takeItem(item);
} }
} }

View File

@@ -1164,7 +1164,7 @@ void WatchModel::insertItem(WatchItem *item)
if (WatchItem *existing = parent->findItem(item->iname)) { if (WatchItem *existing = parent->findItem(item->iname)) {
int row = parent->children().indexOf(existing); int row = parent->children().indexOf(existing);
takeItem(existing); delete takeItem(existing);
parent->insertChild(row, item); parent->insertChild(row, item);
} else { } else {
parent->appendChild(item); parent->appendChild(item);
@@ -1233,7 +1233,7 @@ void WatchHandler::purgeOutdatedItems(const QSet<QByteArray> &inames)
{ {
foreach (const QByteArray &iname, inames) { foreach (const QByteArray &iname, inames) {
WatchItem *item = findItem(iname); WatchItem *item = findItem(iname);
m_model->takeItem(item); delete m_model->takeItem(item);
} }
m_model->layoutChanged(); m_model->layoutChanged();