qquickpixmapcache: Fix invalidation of m_cache while iterating it
Releasing items from the cache modifies m_cache, which we cannot do with a range-for. Fixes: QTBUG-65077 Change-Id: I2efcf6a03b03982a54bb1aacff43c55c45782eaa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
75ebbd0b35
commit
c57681bc37
|
@ -1026,7 +1026,8 @@ QQuickPixmapStore::~QQuickPixmapStore()
|
|||
m_timerId = -2;
|
||||
|
||||
// unreference all (leaked) pixmaps
|
||||
for (auto *pixmap : qAsConst(m_cache)) {
|
||||
const auto cache = m_cache; // NOTE: intentional copy (QTBUG-65077); releasing items from the cache modifies m_cache.
|
||||
for (auto *pixmap : cache) {
|
||||
int currRefCount = pixmap->refCount;
|
||||
if (currRefCount) {
|
||||
#ifndef QT_NO_DEBUG
|
||||
|
|
Loading…
Reference in New Issue