{
public:
QDeclarativeTextureFactory();
- ~QDeclarativeTextureFactory();
+ virtual ~QDeclarativeTextureFactory();
virtual QSGTexture *createTexture(QQuickCanvas *canvas) const = 0;
virtual QSize textureSize() const = 0;
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;
}