diff options
Diffstat (limited to 'src/quick/util/qquickpixmapcache.cpp')
-rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 0dd2a88ca1..dc8bed8125 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -471,6 +471,10 @@ QQuickPixmapReader::QQuickPixmapReader(QQmlEngine *eng) eventLoopQuitHack->moveToThread(this); connect(eventLoopQuitHack, SIGNAL(destroyed(QObject*)), SLOT(quit()), Qt::DirectConnection); start(QThread::LowestPriority); +#if !QT_CONFIG(thread) + // call nonblocking run ourself, as nothread qthread does not + run(); +#endif } QQuickPixmapReader::~QQuickPixmapReader() @@ -948,8 +952,11 @@ void QQuickPixmapReader::run() processJobs(); exec(); +#if QT_CONFIG(thread) + // nothread exec is empty and returns delete threadObject; threadObject = nullptr; +#endif } class QQuickPixmapKey @@ -1019,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 |