diff options
author | Frank Meerkoetter <frank.meerkoetter@basyskom.com> | 2016-05-13 17:57:24 +0200 |
---|---|---|
committer | Frank Meerkoetter <frank.meerkoetter@basyskom.com> | 2016-05-25 19:27:33 +0000 |
commit | 573356464ba73afcbed173d939f9b54d8e201685 (patch) | |
tree | a02271efc22b077831c1cfe6776f3a98ee6b647a | |
parent | b88e0091de65950a3e7c5ace6d8e6ca2b486a07d (diff) |
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>
-rw-r--r-- | src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickshadereffectnode.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 2 | ||||
-rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 4 | ||||
-rw-r--r-- | src/quick/util/qquicksmoothedanimation.cpp | 5 | ||||
-rw-r--r-- | src/quick/util/qquickspringanimation.cpp | 3 |
6 files changed, 9 insertions, 9 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp index a90d03b010..756b6b28be 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp @@ -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); diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp index 246a713dca..5572a36602 100644 --- a/src/quick/items/qquickshadereffectnode.cpp +++ b/src/quick/items/qquickshadereffectnode.cpp @@ -455,7 +455,7 @@ void QQuickShaderEffectMaterial::cleanupMaterialCache() { QQuickShaderEffectMaterialCache *cache = QQuickShaderEffectMaterialCache::get(false); if (cache) { - qDeleteAll(cache->cache.values()); + qDeleteAll(cache->cache); delete cache; } } diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index d91004fbee..db17d572b6 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -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... diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 597613c9fd..dc4b27d738 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -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 diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp index d4956983fb..569cb37c95 100644 --- a/src/quick/util/qquicksmoothedanimation.cpp +++ b/src/quick/util/qquicksmoothedanimation.cpp @@ -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); diff --git a/src/quick/util/qquickspringanimation.cpp b/src/quick/util/qquickspringanimation.cpp index df077350e9..d2bc3b4ece 100644 --- a/src/quick/util/qquickspringanimation.cpp +++ b/src/quick/util/qquickspringanimation.cpp @@ -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); |