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>
This commit is contained in:
Marc Mutz 2014-08-22 21:07:32 +02:00
parent 6244665faa
commit 28f7404256

View File

@ -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();
}