From be0106a92528f7dc47d9fd6e21dd7d7a7ffb9ada Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 8 May 2009 09:02:42 +1000 Subject: Make sure cancelling image loading cancels progress reporting. --- src/declarative/fx/qfxblendedimage.cpp | 4 ++-- src/declarative/fx/qfxhighlightfilter.cpp | 2 +- src/declarative/fx/qfximage.cpp | 4 ++-- src/declarative/fx/qfxparticles.cpp | 2 +- src/declarative/fx/qfxpixmap.cpp | 7 +++++-- src/declarative/fx/qfxpixmap.h | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp index 3326ea8..79b8e41 100644 --- a/src/declarative/fx/qfxblendedimage.cpp +++ b/src/declarative/fx/qfxblendedimage.cpp @@ -101,7 +101,7 @@ void QFxBlendedImage::setPrimaryUrl(const QString &url) if (primSrc == url) return; if (!primSrc.isEmpty()) - QFxPixmap::cancelGet(primUrl,this,SLOT(primaryLoaded())); + QFxPixmap::cancelGet(primUrl,this); primSrc = url; primUrl = qmlContext(this)->resolvedUrl(url); if (!primSrc.isEmpty()) @@ -129,7 +129,7 @@ void QFxBlendedImage::setSecondaryUrl(const QString &url) if (secSrc == url) return; if (!secSrc.isEmpty()) - QFxPixmap::cancelGet(secUrl,this,SLOT(secondaryLoaded())); + QFxPixmap::cancelGet(secUrl,this); secSrc = url; secUrl = qmlContext(this)->resolvedUrl(url); if (!secSrc.isEmpty()) diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp index 862a698..a22ad98 100644 --- a/src/declarative/fx/qfxhighlightfilter.cpp +++ b/src/declarative/fx/qfxhighlightfilter.cpp @@ -149,7 +149,7 @@ void QFxHighlightFilter::setSource(const QString &f) if (d->source == f) return; if (!d->source.isEmpty()) - QFxPixmap::cancelGet(d->url, this, SLOT(imageLoaded())); + QFxPixmap::cancelGet(d->url, this); d->source = f; d->url = qmlContext(this)->resolvedUrl(f); #if defined(QFX_RENDER_OPENGL2) diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index d66846d..e1ac2c7 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -865,9 +865,9 @@ void QFxImage::setSource(const QString &url) } if (!d->url.isEmpty()) - QFxPixmap::cancelGet(d->url, this, SLOT(requestFinished())); + QFxPixmap::cancelGet(d->url, this); if (!d->sciurl.isEmpty()) - QFxPixmap::cancelGet(d->sciurl, this, SLOT(requestFinished())); + QFxPixmap::cancelGet(d->sciurl, this); d->source = url; d->url = qmlContext(this)->resolvedUrl(url); diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp index 8535a73..1aaf256 100644 --- a/src/declarative/fx/qfxparticles.cpp +++ b/src/declarative/fx/qfxparticles.cpp @@ -635,7 +635,7 @@ void QFxParticles::setSource(const QString &name) return; if (!d->source.isEmpty()) - QFxPixmap::cancelGet(d->url, this, SLOT(imageLoaded())); + QFxPixmap::cancelGet(d->url, this); if (name.isEmpty()) { d->source = name; d->url = QUrl(); diff --git a/src/declarative/fx/qfxpixmap.cpp b/src/declarative/fx/qfxpixmap.cpp index 3fdd8e5..0e5a10f 100644 --- a/src/declarative/fx/qfxpixmap.cpp +++ b/src/declarative/fx/qfxpixmap.cpp @@ -275,15 +275,18 @@ QNetworkReply *QFxPixmap::get(QmlEngine *engine, const QUrl& url, QObject* obj, /*! Stops the given slot being invoked if the given url finishes loading. May also cancel loading (eg. if no other pending request). + + Any connections to the QNetworkReply returned by get() will be + disconnected. */ -void QFxPixmap::cancelGet(const QUrl& url, QObject* obj, const char* slot) +void QFxPixmap::cancelGet(const QUrl& url, QObject* obj) { QString key = url.toString(); QFxPixmapCache::Iterator iter = qfxPixmapCache.find(key); if (iter == qfxPixmapCache.end()) return; if ((*iter)->reply) - QObject::disconnect((*iter)->reply, SIGNAL(finished()), obj, slot); + QObject::disconnect((*iter)->reply, 0, obj, 0); // XXX - loading not cancelled. Need to revisit caching } diff --git a/src/declarative/fx/qfxpixmap.h b/src/declarative/fx/qfxpixmap.h index 748991e..297dba7 100644 --- a/src/declarative/fx/qfxpixmap.h +++ b/src/declarative/fx/qfxpixmap.h @@ -67,7 +67,7 @@ public: QFxPixmap &operator=(const QFxPixmap &); static QNetworkReply *get(QmlEngine *, const QUrl& url, QObject*, const char* slot); - static void cancelGet(const QUrl& url, QObject* obj, const char* slot); + static void cancelGet(const QUrl& url, QObject* obj); bool isNull() const; -- cgit v0.12