From 2164656f4f010950d38de65ee826520c66d15180 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 19 Jun 2009 11:08:08 +1000 Subject: Ensure image loads are cencelled if item destroyed. (most obvious when item is in a delegate) --- src/declarative/fx/qfxblendedimage.cpp | 11 +++++++++++ src/declarative/fx/qfxblendedimage.h | 1 + src/declarative/fx/qfxhighlightfilter.cpp | 2 ++ src/declarative/fx/qfximage.cpp | 17 +++++++++++------ src/declarative/fx/qfxparticles.cpp | 3 +++ 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp index e216196..0c93fef 100644 --- a/src/declarative/fx/qfxblendedimage.cpp +++ b/src/declarative/fx/qfxblendedimage.cpp @@ -81,6 +81,17 @@ QFxBlendedImage::QFxBlendedImage(QFxItem *parent) } /*! + Cancels any pending image loads and destroys the image. +*/ +QFxBlendedImage::~QFxBlendedImage() +{ + if (!primUrl.isEmpty()) + QFxPixmap::cancelGet(primUrl,this); + if (!secUrl.isEmpty()) + QFxPixmap::cancelGet(secUrl,this); +} + +/*! \qmlproperty string BlendedImage::primaryUrl The URL of the first image to be displayed in this item. */ diff --git a/src/declarative/fx/qfxblendedimage.h b/src/declarative/fx/qfxblendedimage.h index 7169b92..248cc9d 100644 --- a/src/declarative/fx/qfxblendedimage.h +++ b/src/declarative/fx/qfxblendedimage.h @@ -63,6 +63,7 @@ class Q_DECLARATIVE_EXPORT QFxBlendedImage : public QFxItem Q_PROPERTY(bool smooth READ smoothTransform WRITE setSmoothTransform) public: QFxBlendedImage(QFxItem *parent=0); + ~QFxBlendedImage(); QUrl primaryUrl() const; void setPrimaryUrl(const QUrl &); diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp index 2c6fb0a..1671fc6 100644 --- a/src/declarative/fx/qfxhighlightfilter.cpp +++ b/src/declarative/fx/qfxhighlightfilter.cpp @@ -114,6 +114,8 @@ QFxHighlightFilter::QFxHighlightFilter(QObject *parent) QFxHighlightFilter::~QFxHighlightFilter() { + if (!d->url.isEmpty()) + QFxPixmap::cancelGet(d->url, this); delete d; d = 0; } diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 05738e3..40389c4 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -127,6 +127,10 @@ QFxImage::~QFxImage() Q_D(QFxImage); if (d->sciReply) d->sciReply->deleteLater(); + if (!d->url.isEmpty()) + QFxPixmap::cancelGet(d->url, this); + if (!d->sciurl.isEmpty()) + QFxPixmap::cancelGet(d->sciurl, this); #if defined(QFX_RENDER_OPENGL) if (d->tex) { d->tex->release(); @@ -972,6 +976,13 @@ void QFxImage::setGridScaledImage(const QFxGridScaledImage& sci) d->status = Error; emit statusChanged(d->status); } else { + QFxScaleGrid *sg = scaleGrid(); + sg->setTop(sci.gridTop()); + sg->setBottom(sci.gridBottom()); + sg->setLeft(sci.gridLeft()); + sg->setRight(sci.gridRight()); + setOptions(QFxImage::SimpleItem, false); + d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl())); d->reply = QFxPixmap::get(qmlEngine(this), d->sciurl, this, SLOT(requestFinished())); if (d->reply) { @@ -981,12 +992,6 @@ void QFxImage::setGridScaledImage(const QFxGridScaledImage& sci) d->progress = 1.0; emit progressChanged(d->progress); } - QFxScaleGrid *sg = scaleGrid(); - sg->setTop(sci.gridTop()); - sg->setBottom(sci.gridBottom()); - sg->setLeft(sci.gridLeft()); - sg->setRight(sci.gridRight()); - setOptions(QFxImage::SimpleItem, false); } } diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp index 25e359d..4cd34c4 100644 --- a/src/declarative/fx/qfxparticles.cpp +++ b/src/declarative/fx/qfxparticles.cpp @@ -630,6 +630,9 @@ QFxParticles::QFxParticles(QFxParticlesPrivate &dd, QFxItem *parent) QFxParticles::~QFxParticles() { + Q_D(QFxParticles); + if (!d->url.isEmpty()) + QFxPixmap::cancelGet(d->url, this); } /*! -- cgit v0.12 From a66a9cdf6eed479d2da65dd860d233b79c8601ec Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 19 Jun 2009 11:23:07 +1000 Subject: For QSimpleCanvas, avoid it being given initial default size. See also 1312c0ca987b008d43558ff4cfa69b8dfd11616e --- tools/qmlviewer/main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp index 5c75656..0b370fb 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qmlviewer/main.cpp @@ -154,11 +154,13 @@ int main(int argc, char ** argv) viewer.setDeviceKeys(true); viewer.setRecordDither(dither); viewer.setRecordArgs(recordargs); - viewer.show(); - if (!fileName.isEmpty()) + if (!fileName.isEmpty()) { viewer.openQml(fileName); - else + viewer.show(); + } else { + viewer.show(); viewer.open(); + } return app.exec(); } -- cgit v0.12