diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-07-08 05:04:48 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-07-13 05:18:01 (GMT) |
commit | 30afdcfb0eb5c926de434dc65076a97c87ac8d5d (patch) | |
tree | 8067a42329b3e13f4f7191222db46552fe8252c6 /src/declarative/util | |
parent | 174216f57b881ff1ab9d7df8bdbb5e2564df51b0 (diff) | |
download | Qt-30afdcfb0eb5c926de434dc65076a97c87ac8d5d.zip Qt-30afdcfb0eb5c926de434dc65076a97c87ac8d5d.tar.gz Qt-30afdcfb0eb5c926de434dc65076a97c87ac8d5d.tar.bz2 |
Don't double delete cancelled pixmap cache requests
QTBUG-11954
(cherry picked from commit cec6d01d17e39af6e8a139156a3b51fd45558a50)
Diffstat (limited to 'src/declarative/util')
-rw-r--r-- | src/declarative/util/qdeclarativepixmapcache.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index 3f496b3..f729ced 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -358,7 +358,9 @@ void QDeclarativePixmapReader::networkRequestDone() } } // send completion event to the QDeclarativePixmapReply - job->postReply(error, errorString, readSize, image); + mutex.lock(); + if (!cancelled.contains(job)) job->postReply(error, errorString, readSize, image); + mutex.unlock(); } reply->deleteLater(); @@ -438,7 +440,9 @@ void QDeclarativePixmapReader::processJob(QDeclarativePixmapReply *runningJob) errorStr = QDeclarativePixmap::tr("Failed to get image from provider: %1").arg(url.toString()); } - runningJob->postReply(errorCode, errorStr, readSize, image); + mutex.lock(); + if (!cancelled.contains(runningJob)) runningJob->postReply(errorCode, errorStr, readSize, image); + mutex.unlock(); } else { QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url); if (!lf.isEmpty()) { @@ -455,7 +459,9 @@ void QDeclarativePixmapReader::processJob(QDeclarativePixmapReply *runningJob) errorStr = QDeclarativePixmap::tr("Cannot open: %1").arg(url.toString()); errorCode = QDeclarativePixmapReply::Loading; } - runningJob->postReply(errorCode, errorStr, readSize, image); + mutex.lock(); + if (!cancelled.contains(runningJob)) runningJob->postReply(errorCode, errorStr, readSize, image); + mutex.unlock(); } else { // Network resource QNetworkRequest req(url); |