summaryrefslogtreecommitdiffstats
path: root/src/declarative/util/qmlpixmapcache.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-02-01 01:10:31 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-02-01 01:10:31 (GMT)
commit6e8feab83fa9303b1345f4a27478ba3ee0316e86 (patch)
tree954fe6dacbd61c80e20a6d751fbabf5b16c3bf52 /src/declarative/util/qmlpixmapcache.cpp
parentc1ff07502cde66ccf4c1fc86b3ad2eac66fbea40 (diff)
downloadQt-6e8feab83fa9303b1345f4a27478ba3ee0316e86.zip
Qt-6e8feab83fa9303b1345f4a27478ba3ee0316e86.tar.gz
Qt-6e8feab83fa9303b1345f4a27478ba3ee0316e86.tar.bz2
Ensure pixmaps can be retrieved even if they do not fit in the QPixmapCache.
Fixes QT-2280
Diffstat (limited to 'src/declarative/util/qmlpixmapcache.cpp')
-rw-r--r--src/declarative/util/qmlpixmapcache.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/declarative/util/qmlpixmapcache.cpp b/src/declarative/util/qmlpixmapcache.cpp
index 6f36cad..1f68512 100644
--- a/src/declarative/util/qmlpixmapcache.cpp
+++ b/src/declarative/util/qmlpixmapcache.cpp
@@ -293,7 +293,7 @@ bool QmlPixmapReply::event(QEvent *event)
} else {
qWarning() << "Error decoding" << d->urlKey;
}
- QPixmapCache::insert(d->urlKey, d->pixmap);
+ QPixmapCache::insert(d->urlKey, d->pixmap); // note: may fail (returns false)
emit finished();
}
return true;
@@ -374,8 +374,14 @@ QmlPixmapReply::Status QmlPixmapCache::get(const QUrl& url, QPixmap *pixmap)
#endif
QString key = url.toString();
+
QmlPixmapReplyHash::Iterator iter = qmlActivePixmapReplies.find(key);
- if (QPixmapCache::find(key, pixmap)) {
+ if (iter != qmlActivePixmapReplies.end() && (*iter)->status() == QmlPixmapReply::Ready) {
+ // Must check this, since QPixmapCache::insert may have failed.
+ *pixmap = (*iter)->d_func()->pixmap;
+ status = (*iter)->status();
+ (*iter)->release();
+ } else if (QPixmapCache::find(key, pixmap)) {
if (iter != qmlActivePixmapReplies.end()) {
status = (*iter)->status();
(*iter)->release();