diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-02-01 21:53:47 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-02-01 21:53:47 (GMT) |
commit | e93f76cc533751944e66c02d868f3c527814efa0 (patch) | |
tree | 9a79f06ad7be400ff432a7edae33be4599a0658c /src/declarative/util/qmlpixmapcache.cpp | |
parent | bd95a353c621cb7dba2f0991e742ddbde0bb9a54 (diff) | |
parent | 652be80c25f61aa4fbf28d75ba9971fc709f29c9 (diff) | |
download | Qt-e93f76cc533751944e66c02d868f3c527814efa0.zip Qt-e93f76cc533751944e66c02d868f3c527814efa0.tar.gz Qt-e93f76cc533751944e66c02d868f3c527814efa0.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/util/qmlpixmapcache.cpp')
-rw-r--r-- | src/declarative/util/qmlpixmapcache.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/declarative/util/qmlpixmapcache.cpp b/src/declarative/util/qmlpixmapcache.cpp index 331c0ce..bfe99ac 100644 --- a/src/declarative/util/qmlpixmapcache.cpp +++ b/src/declarative/util/qmlpixmapcache.cpp @@ -404,7 +404,7 @@ bool QmlPixmapReply::event(QEvent *event) d->pixmap = QPixmap::fromImage(de->image); QByteArray key = d->url.toEncoded(QUrl::FormattingOption(0x100)); QString strKey = QString::fromLatin1(key.constData(), key.count()); - QPixmapCache::insert(strKey, d->pixmap); + QPixmapCache::insert(strKey, d->pixmap); // note: may fail (returns false) emit finished(); } return true; @@ -499,7 +499,12 @@ QmlPixmapReply::Status QmlPixmapCache::get(const QUrl& url, QPixmap *pixmap) QByteArray key = url.toEncoded(QUrl::FormattingOption(0x100)); QString strKey = QString::fromLatin1(key.constData(), key.count()); QmlPixmapReplyHash::Iterator iter = qmlActivePixmapReplies()->find(url); - if (QPixmapCache::find(strKey, 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(strKey, pixmap)) { if (iter != qmlActivePixmapReplies()->end()) { status = (*iter)->status(); (*iter)->release(); |