diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2021-08-31 15:34:10 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2021-09-01 17:11:44 +0200 |
commit | dc65267ad8c086950c23185c8cebc304a8d1c3dc (patch) | |
tree | 0f2df4837da48e0e0d88e902816f97a77ff847d3 /src/gui/image | |
parent | e3d5d363f73528f342e1464593ce8a682b77834d (diff) |
When clearing QPixmapCache, stop its flushing timer
No need for timer event to reduce cache size when it is already empty.
May also avoid the "Timers cannot be stopped from another thread"
warning at exit, if the global cache object is then deleted by another
thread.
Fixes: QTBUG-96101
Pick-to: 6.2 5.15
Change-Id: Id1aeecfbb43a25a887ebd5cc7242749a74290bb0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qpixmapcache.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 26cc80b5b0..b3d22b48a1 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -461,6 +461,11 @@ void QPMCache::clear() for (int i = 0; i < keys.size(); ++i) keys.at(i).d->isValid = false; QCache<QPixmapCache::Key, QPixmapCacheEntry>::clear(); + // Nothing left to flush; stop the timer + if (theid) { + killTimer(theid); + theid = 0; + } } QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key) |