summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx/qfximagebase.cpp
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2009-08-26 09:47:53 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2009-08-26 09:52:58 (GMT)
commit3d33fb250c4d23b746124b8d1f1a974cdacb48e6 (patch)
tree26074e31da1df6f0a63b24cdf0959e0ed648ea99 /src/declarative/fx/qfximagebase.cpp
parent5d29928f2988c474a9b7e8554860851bef15b989 (diff)
downloadQt-3d33fb250c4d23b746124b8d1f1a974cdacb48e6.zip
Qt-3d33fb250c4d23b746124b8d1f1a974cdacb48e6.tar.gz
Qt-3d33fb250c4d23b746124b8d1f1a974cdacb48e6.tar.bz2
Fix unbalanced calls to QFxPixmapCache::get && cancelGet
Explicitly track whether there is a QFxPixmapCache request pending, and only call QFxPixmapCache::cancelGet if this is the case. This should fix an issue in Bauhaus where multiple instances are loading the same image, and one instance calling cancelGet without ever having called get before is messing up the QFxPixmapCache request counting.
Diffstat (limited to 'src/declarative/fx/qfximagebase.cpp')
-rw-r--r--src/declarative/fx/qfximagebase.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/declarative/fx/qfximagebase.cpp b/src/declarative/fx/qfximagebase.cpp
index 5aa87db..a68c1f9 100644
--- a/src/declarative/fx/qfximagebase.cpp
+++ b/src/declarative/fx/qfximagebase.cpp
@@ -64,7 +64,7 @@ QFxImageBase::QFxImageBase(QFxImageBasePrivate &dd, QFxItem *parent)
QFxImageBase::~QFxImageBase()
{
Q_D(QFxImageBase);
- if (!d->url.isEmpty())
+ if (d->pendingPixmapCache)
QFxPixmapCache::cancelGet(d->url, this);
}
@@ -94,8 +94,10 @@ void QFxImageBase::setSource(const QUrl &url)
if ((d->url.isEmpty() == url.isEmpty()) && url == d->url)
return;
- if (!d->url.isEmpty())
+ if (d->pendingPixmapCache) {
QFxPixmapCache::cancelGet(d->url, this);
+ d->pendingPixmapCache = false;
+ }
d->url = url;
if (d->progress != 0.0) {
@@ -117,6 +119,7 @@ void QFxImageBase::setSource(const QUrl &url)
d->status = Loading;
QNetworkReply *reply = QFxPixmapCache::get(qmlEngine(this), d->url, &d->pix);
if (reply) {
+ d->pendingPixmapCache = true;
connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
this, SLOT(requestProgress(qint64,qint64)));
@@ -141,6 +144,9 @@ void QFxImageBase::setSource(const QUrl &url)
void QFxImageBase::requestFinished()
{
Q_D(QFxImageBase);
+
+ d->pendingPixmapCache = false;
+
if (!QFxPixmapCache::find(d->url, &d->pix))
d->status = Error;
setImplicitWidth(d->pix.width());