diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-09-02 07:27:57 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-09-02 07:27:57 (GMT) |
commit | b6d47ea4872e188d8da6886cb1922f1a89245825 (patch) | |
tree | ec4818282531b9cd1689ba4a61b32bee48080c8d /src/declarative | |
parent | ce698d243f31d2b9adcdf2b6b40f5844c200b159 (diff) | |
download | Qt-b6d47ea4872e188d8da6886cb1922f1a89245825.zip Qt-b6d47ea4872e188d8da6886cb1922f1a89245825.tar.gz Qt-b6d47ea4872e188d8da6886cb1922f1a89245825.tar.bz2 |
Don't overflow the unreferenced cost counter
QTBUG-13345
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/util/qdeclarativepixmapcache.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index de2de21..4fc52f5 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -155,7 +155,7 @@ protected: private: friend class QDeclarativePixmapReaderThreadObject; void processJobs(); - void processJob(QDeclarativePixmapReply *); + void processJob(QDeclarativePixmapReply *, const QUrl &, const QSize &); void networkRequestDone(QNetworkReply *); QList<QDeclarativePixmapReply*> jobs; @@ -434,23 +434,24 @@ void QDeclarativePixmapReader::processJobs() QDeclarativePixmapReply *runningJob = jobs.takeLast(); runningJob->loading = true; + QUrl url = runningJob->data->url; + QSize requestSize = runningJob->data->requestSize; locker.unlock(); - processJob(runningJob); + processJob(runningJob, url, requestSize); locker.relock(); } } } -void QDeclarativePixmapReader::processJob(QDeclarativePixmapReply *runningJob) +void QDeclarativePixmapReader::processJob(QDeclarativePixmapReply *runningJob, const QUrl &url, + const QSize &requestSize) { - QUrl url = runningJob->data->url; - // fetch if (url.scheme() == QLatin1String("image")) { // Use QmlImageProvider QSize readSize; QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); - QImage image = ep->getImageFromProvider(url, &readSize, runningJob->data->requestSize); + QImage image = ep->getImageFromProvider(url, &readSize, requestSize); QDeclarativePixmapReply::ReadError errorCode = QDeclarativePixmapReply::NoError; QString errorStr; @@ -472,7 +473,7 @@ void QDeclarativePixmapReader::processJob(QDeclarativePixmapReply *runningJob) QFile f(lf); QSize readSize; if (f.open(QIODevice::ReadOnly)) { - if (!readImage(url, &f, &image, &errorStr, &readSize, runningJob->data->requestSize)) + if (!readImage(url, &f, &image, &errorStr, &readSize, requestSize)) errorCode = QDeclarativePixmapReply::Loading; } else { errorStr = QDeclarativePixmap::tr("Cannot open: %1").arg(url.toString()); @@ -663,6 +664,7 @@ void QDeclarativePixmapStore::shrinkCache(int remove) data->prevUnreferenced = 0; remove -= data->cost(); + m_unreferencedCost -= data->cost(); data->removeFromCache(); delete data; } |