QIconLoader: enable an easy case of transactional processing

It's easy to do the work on the side and then commit. This is strongly
exception safe, but in Qt, we don't care. But transactional code, when
this easy to achieve, is also clearer.

Change-Id: I30f1badec7745d62a09af4eede234cb312b373aa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Marc Mutz 2014-08-22 21:13:40 +02:00
parent 97a32c8440
commit de068472f1

View File

@ -561,15 +561,16 @@ void QIconLoaderEngine::virtual_hook(int id, void *data)
{
QIconEngine::AvailableSizesArgument &arg
= *reinterpret_cast<QIconEngine::AvailableSizesArgument*>(data);
arg.sizes.clear();
const int N = m_entries.size();
arg.sizes.reserve(N);
QList<QSize> sizes;
sizes.reserve(N);
// Gets all sizes from the DirectoryInfo entries
for (int i = 0; i < N; ++i) {
int size = m_entries.at(i)->dir.size;
arg.sizes.append(QSize(size, size));
sizes.append(QSize(size, size));
}
arg.sizes.swap(sizes); // commit
}
break;
case QIconEngine::IconNameHook: