diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-08-22 21:07:32 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2014-08-23 13:18:33 +0200 |
commit | 28f740425654855fcbdb13108c3fdb2c03a16340 (patch) | |
tree | 8b4584be43bf44de72abb0a30bb10592b89f6b10 /src/gui/image | |
parent | 6244665faa0c703efa29943832d8c90726f7e8b1 (diff) | |
download | qtbase-28f740425654855fcbdb13108c3fdb2c03a16340.tar.gz |
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 <ogoffart@woboq.com>
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qiconloader.cpp | 8 |
1 files 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(); } |