void unreferencePixmap(QDeclarativePixmapData *);
void referencePixmap(QDeclarativePixmapData *);
+ void purgeCache();
+
protected:
virtual void timerEvent(QTimerEvent *);
data->nextUnreferenced = m_unreferencedPixmaps;
data->prevUnreferencedPtr = &m_unreferencedPixmaps;
+ if (!m_destroying) // the texture factories may have been cleaned up already.
+ m_unreferencedCost += data->cost();
m_unreferencedPixmaps = data;
if (m_unreferencedPixmaps->nextUnreferenced) {
if (!m_lastUnreferencedPixmap)
m_lastUnreferencedPixmap = data;
- m_unreferencedCost += data->cost();
-
shrinkCache(-1); // Shrink the cache incase it has become larger than cache_limit
if (m_timerId == -1 && m_unreferencedPixmaps && !m_destroying)
data->prevUnreferencedPtr = 0;
data->prevUnreferenced = 0;
- remove -= data->cost();
- m_unreferencedCost -= data->cost();
+ if (!m_destroying) {
+ remove -= data->cost();
+ m_unreferencedCost -= data->cost();
+ }
data->removeFromCache();
delete data;
}
}
}
+void QDeclarativePixmapStore::purgeCache()
+{
+ shrinkCache(m_unreferencedCost);
+}
+
+void QDeclarativePixmap::purgeCache()
+{
+ pixmapStore()->purgeCache();
+}
+
QDeclarativePixmapReply::QDeclarativePixmapReply(QDeclarativePixmapData *d)
: data(d), engineForReader(0), requestSize(d->requestSize), url(d->url), loading(false), redirectCount(0)
{