diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-07-08 05:04:48 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-07-08 05:09:42 (GMT) |
commit | cec6d01d17e39af6e8a139156a3b51fd45558a50 (patch) | |
tree | a9061d9c215f59e05da3937ad459a8f6a1525ad3 /src/declarative/util | |
parent | a258456bcb35ec4211751a702ea94a1881d82a07 (diff) | |
download | Qt-cec6d01d17e39af6e8a139156a3b51fd45558a50.zip Qt-cec6d01d17e39af6e8a139156a3b51fd45558a50.tar.gz Qt-cec6d01d17e39af6e8a139156a3b51fd45558a50.tar.bz2 |
Don't double delete cancelled pixmap cache requests
QTBUG-11954
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); |