From 28f740425654855fcbdb13108c3fdb2c03a16340 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 22 Aug 2014 21:07:32 +0200 Subject: [PATCH] QIconLoader: replace while(!empty()) delete takeLast() with qDeleteAll() There's no calling back into QIconLoaderEngine from the QIconLoaderEngineEntry dtors, so don't bother slicing off one element by one from the container as they are deleted, the more so as m_entires is either move-assigned or deleted right after these loops. Change-Id: Ic9ffa442ef0b0c59e19eb91d164183ea5c3bab67 Reviewed-by: Olivier Goffart --- src/gui/image/qiconloader.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 004cd7493f..62ec7fac2e 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -332,9 +332,7 @@ QIconLoaderEngine::QIconLoaderEngine(const QString& iconName) QIconLoaderEngine::~QIconLoaderEngine() { - while (!m_entries.isEmpty()) - delete m_entries.takeLast(); - Q_ASSERT(m_entries.size() == 0); + qDeleteAll(m_entries); } QIconLoaderEngine::QIconLoaderEngine(const QIconLoaderEngine &other) @@ -370,10 +368,8 @@ void QIconLoaderEngine::ensureLoaded() { if (!(QIconLoader::instance()->themeKey() == m_key)) { - while (!m_entries.isEmpty()) - delete m_entries.takeLast(); + qDeleteAll(m_entries); - Q_ASSERT(m_entries.size() == 0); m_entries = QIconLoader::instance()->loadIcon(m_iconName); m_key = QIconLoader::instance()->themeKey(); }