diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-02-01 01:10:31 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-02-01 01:10:31 (GMT) |
commit | 6e8feab83fa9303b1345f4a27478ba3ee0316e86 (patch) | |
tree | 954fe6dacbd61c80e20a6d751fbabf5b16c3bf52 /src | |
parent | c1ff07502cde66ccf4c1fc86b3ad2eac66fbea40 (diff) | |
download | Qt-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')
-rw-r--r-- | src/declarative/util/qmlpixmapcache.cpp | 10 |
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(); |