From 90656ea455abfca233ae7be30e00bb492d438459 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 15 Jun 2015 15:40:22 +0200 Subject: [PATCH] Debugger: Delete pointer if no more needed Introduced with 2b19081cb0840fe9e8d467e7905fbefb680858e1 Change-Id: I817ec48b9098f46ca703a6075d4657f0b7eb9948 Reviewed-by: hjk --- src/plugins/debugger/moduleshandler.cpp | 4 ++-- src/plugins/debugger/watchhandler.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/debugger/moduleshandler.cpp b/src/plugins/debugger/moduleshandler.cpp index 0e62454b78f..5c37a8b1d14 100644 --- a/src/plugins/debugger/moduleshandler.cpp +++ b/src/plugins/debugger/moduleshandler.cpp @@ -212,7 +212,7 @@ Modules ModulesHandler::modules() const void ModulesHandler::removeModule(const QString &modulePath) { if (ModuleItem *item = moduleFromPath(m_model->rootItem(), modulePath)) - m_model->takeItem(item); + delete m_model->takeItem(item); } void ModulesHandler::updateModule(const Module &module) @@ -254,7 +254,7 @@ void ModulesHandler::endUpdateAll() for (int i = root->rowCount(); --i >= 0; ) { auto item = static_cast(root->child(i)); if (!item->updated) - m_model->takeItem(item); + delete m_model->takeItem(item); } } diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 97c90afa163..1bef8ea50a0 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -1164,7 +1164,7 @@ void WatchModel::insertItem(WatchItem *item) if (WatchItem *existing = parent->findItem(item->iname)) { int row = parent->children().indexOf(existing); - takeItem(existing); + delete takeItem(existing); parent->insertChild(row, item); } else { parent->appendChild(item); @@ -1233,7 +1233,7 @@ void WatchHandler::purgeOutdatedItems(const QSet &inames) { foreach (const QByteArray &iname, inames) { WatchItem *item = findItem(iname); - m_model->takeItem(item); + delete m_model->takeItem(item); } m_model->layoutChanged();