aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2012-07-27 13:38:43 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-27 08:43:06 +0200
commitd3224ad22a38264aaae81e96384182aee7c1053f (patch)
treebfe95c25c969ce90d17a42868f57a7893633d5d3 /src/quick/util
parent0408dcd6a9d45e110610c6ed14987189d4e16c90 (diff)
Pixmap loader adds images to unreferenced list when cache: false
Don't add uncached images to the unreferenced list, since they cannot be reused later as they are not in the cache. Additionally, we currently search for images in the cache, even if we set cache: false. Setting cache false should not put images in the cache and should not use images that are in the cache. Task-number: QTBUG-26676 Change-Id: Ib7eb42199ae6ae6154b696c83ad1dd959e0f208f Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/util')
-rw-r--r--src/quick/util/qquickpixmapcache.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index 1f4da46ca6..6ac5be5f13 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -902,7 +902,10 @@ void QQuickPixmapData::release()
}
if (pixmapStatus == QQuickPixmap::Ready) {
- pixmapStore()->unreferencePixmap(this);
+ if (inCache)
+ pixmapStore()->unreferencePixmap(this);
+ else
+ delete this;
} else {
removeFromCache();
delete this;
@@ -1163,7 +1166,12 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &reques
QQuickPixmapKey key = { &url, &requestSize };
QQuickPixmapStore *store = pixmapStore();
- QHash<QQuickPixmapKey, QQuickPixmapData *>::Iterator iter = store->m_cache.find(key);
+ QHash<QQuickPixmapKey, QQuickPixmapData *>::Iterator iter = store->m_cache.end();
+
+ // If Cache is disabled, the pixmap will always be loaded, even if there is an existing
+ // cached version.
+ if (options & QQuickPixmap::Cache)
+ iter = store->m_cache.find(key);
if (iter == store->m_cache.end()) {
if (url.scheme() == QLatin1String("image")) {