diff options
Diffstat (limited to 'src/quick/util/qquickpixmapcache.cpp')
-rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 85e155f081..aae5306aa7 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -762,6 +762,8 @@ void QQuickPixmapStore::unreferencePixmap(QQuickPixmapData *data) 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) { @@ -772,8 +774,6 @@ void QQuickPixmapStore::unreferencePixmap(QQuickPixmapData *data) 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) @@ -810,8 +810,10 @@ void QQuickPixmapStore::shrinkCache(int remove) 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; } |