Fixed another batch of QHash/QMap::values() (mis)use
Avoid memory allocations. Change-Id: I0b4cbef6a8c22184781a44d92172d93ac38e778c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
b88e0091de
commit
573356464b
|
@ -114,7 +114,7 @@ void QV4DebuggerAgent::addDebugger(QV4Debugger *debugger)
|
|||
|
||||
debugger->setBreakOnThrow(m_breakOnThrow);
|
||||
|
||||
foreach (const BreakPoint &breakPoint, m_breakPoints.values())
|
||||
for (const BreakPoint &breakPoint : qAsConst(m_breakPoints))
|
||||
if (breakPoint.enabled)
|
||||
debugger->addBreakPoint(breakPoint.fileName, breakPoint.lineNr, breakPoint.condition);
|
||||
|
||||
|
|
|
@ -455,7 +455,7 @@ void QQuickShaderEffectMaterial::cleanupMaterialCache()
|
|||
{
|
||||
QQuickShaderEffectMaterialCache *cache = QQuickShaderEffectMaterialCache::get(false);
|
||||
if (cache) {
|
||||
qDeleteAll(cache->cache.values());
|
||||
qDeleteAll(cache->cache);
|
||||
delete cache;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -845,7 +845,7 @@ Renderer::~Renderer()
|
|||
for (int i=0; i<m_batchPool.size(); ++i) qsg_wipeBatch(m_batchPool.at(i), this);
|
||||
}
|
||||
|
||||
foreach (Node *n, m_nodes.values())
|
||||
for (Node *n : qAsConst(m_nodes))
|
||||
m_nodeAllocator.release(n);
|
||||
|
||||
// Remaining elements...
|
||||
|
|
|
@ -922,15 +922,13 @@ QQuickPixmapStore::~QQuickPixmapStore()
|
|||
#ifndef QT_NO_DEBUG
|
||||
int leakedPixmaps = 0;
|
||||
#endif
|
||||
QList<QQuickPixmapData*> cachedData = m_cache.values();
|
||||
|
||||
// Prevent unreferencePixmap() from assuming it needs to kick
|
||||
// off the cache expiry timer, as we're shrinking the cache
|
||||
// manually below after releasing all the pixmaps.
|
||||
m_timerId = -2;
|
||||
|
||||
// unreference all (leaked) pixmaps
|
||||
foreach (QQuickPixmapData* pixmap, cachedData) {
|
||||
for (auto *pixmap : qAsConst(m_cache)) {
|
||||
int currRefCount = pixmap->refCount;
|
||||
if (currRefCount) {
|
||||
#ifndef QT_NO_DEBUG
|
||||
|
|
|
@ -392,7 +392,7 @@ QQuickSmoothedAnimationPrivate::~QQuickSmoothedAnimationPrivate()
|
|||
|
||||
void QQuickSmoothedAnimationPrivate::updateRunningAnimations()
|
||||
{
|
||||
foreach(QSmoothedAnimation* ease, activeAnimations.values()){
|
||||
for (QSmoothedAnimation *ease : qAsConst(activeAnimations)) {
|
||||
ease->maximumEasingTime = anim->maximumEasingTime;
|
||||
ease->reversingMode = anim->reversingMode;
|
||||
ease->velocity = anim->velocity;
|
||||
|
@ -444,7 +444,8 @@ QAbstractAnimationJob* QQuickSmoothedAnimation::transition(QQuickStateActions &a
|
|||
anims.insert(ease);
|
||||
}
|
||||
|
||||
foreach (QSmoothedAnimation *ease, d->activeAnimations.values()){
|
||||
const auto copy = d->activeAnimations;
|
||||
for (QSmoothedAnimation *ease : copy) {
|
||||
if (!anims.contains(ease)) {
|
||||
ease->clearTemplate();
|
||||
d->activeAnimations.remove(ease->target);
|
||||
|
|
|
@ -585,7 +585,8 @@ QAbstractAnimationJob* QQuickSpringAnimation::transition(QQuickStateActions &act
|
|||
animation->restart();
|
||||
anims.insert(animation);
|
||||
}
|
||||
foreach (QSpringAnimation *anim, d->activeAnimations.values()){
|
||||
const auto copy = d->activeAnimations;
|
||||
for (QSpringAnimation *anim : copy) {
|
||||
if (!anims.contains(anim)) {
|
||||
anim->clearTemplate();
|
||||
d->activeAnimations.remove(anim->target);
|
||||
|
|
Loading…
Reference in New Issue