diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-03-05 11:39:24 +1000 |
---|---|---|
committer | Matthew Vogt <matthew.vogt@nokia.com> | 2012-03-05 11:39:54 +1000 |
commit | 0284817d6cd7e17afa8da26ee6e9199100754446 (patch) | |
tree | c351d55d5a606c81c72e481f846b9b9e2603c883 /src/quick/util/qquickpixmapcache.cpp | |
parent | 377eb94eb19dafeca20d12bc6b624f1779fae514 (diff) | |
parent | 36bd7f616f37f5f60e59bce1f0d8970248d627de (diff) |
Merge master <-> api_changes
Change-Id: Iad2f07b989b25349fd2d4fff010e24dcd5a1688f
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; } |