summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-03-30 04:09:56 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-03-30 04:31:23 (GMT)
commit462429f5692f810bdd4e04b916db5f9af428d9e4 (patch)
treef8af36c891c2ff9a76ecf80cee4ac68d1e87af13 /src/declarative/graphicsitems/qdeclarativeimagebase.cpp
parentb94176e69efc3948696c6774d5a228fc753b5b29 (diff)
downloadQt-462429f5692f810bdd4e04b916db5f9af428d9e4.zip
Qt-462429f5692f810bdd4e04b916db5f9af428d9e4.tar.gz
Qt-462429f5692f810bdd4e04b916db5f9af428d9e4.tar.bz2
Canceling image download while reading causes crash
We were deleting a QObject owned by another thread, which is fine if there are no pending events, but very bad if there are, e.g. queued signals due to downloadProgress() updates. Use deleteLater() which is safe to call in any thread. Also call QDeclarativePixmap::clear(QObject *obj) where appropriate to remove connections and ensure we don't handle any unwanted signals after the download is cancelled. Change-Id: Ia8fb41a8cd004d9840e7cec35915f1afdb03ac4d Task-number: QTBUG-18412 Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeimagebase.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
index 2de3ba0..8f4416f 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
@@ -176,7 +176,7 @@ void QDeclarativeImageBase::load()
Q_D(QDeclarativeImageBase);
if (d->url.isEmpty()) {
- d->pix.clear();
+ d->pix.clear(this);
d->status = Null;
d->progress = 0.0;
setImplicitWidth(0);
@@ -191,6 +191,7 @@ void QDeclarativeImageBase::load()
options |= QDeclarativePixmap::Asynchronous;
if (d->cache)
options |= QDeclarativePixmap::Cache;
+ d->pix.clear(this);
d->pix.load(qmlEngine(this), d->url, d->explicitSourceSize ? sourceSize() : QSize(), options);
if (d->pix.isLoading()) {