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:
parent
6244665faa
commit
28f7404256
@ -332,9 +332,7 @@ QIconLoaderEngine::QIconLoaderEngine(const QString& iconName)
|
|||||||
|
|
||||||
QIconLoaderEngine::~QIconLoaderEngine()
|
QIconLoaderEngine::~QIconLoaderEngine()
|
||||||
{
|
{
|
||||||
while (!m_entries.isEmpty())
|
qDeleteAll(m_entries);
|
||||||
delete m_entries.takeLast();
|
|
||||||
Q_ASSERT(m_entries.size() == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QIconLoaderEngine::QIconLoaderEngine(const QIconLoaderEngine &other)
|
QIconLoaderEngine::QIconLoaderEngine(const QIconLoaderEngine &other)
|
||||||
@ -370,10 +368,8 @@ void QIconLoaderEngine::ensureLoaded()
|
|||||||
{
|
{
|
||||||
if (!(QIconLoader::instance()->themeKey() == m_key)) {
|
if (!(QIconLoader::instance()->themeKey() == m_key)) {
|
||||||
|
|
||||||
while (!m_entries.isEmpty())
|
qDeleteAll(m_entries);
|
||||||
delete m_entries.takeLast();
|
|
||||||
|
|
||||||
Q_ASSERT(m_entries.size() == 0);
|
|
||||||
m_entries = QIconLoader::instance()->loadIcon(m_iconName);
|
m_entries = QIconLoader::instance()->loadIcon(m_iconName);
|
||||||
m_key = QIconLoader::instance()->themeKey();
|
m_key = QIconLoader::instance()->themeKey();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user