summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2021-08-31 15:34:10 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-09-01 17:06:52 +0000
commitce006d117e343fce748f48a58533459d7ca428b9 (patch)
tree34e16c529e695a6ea258763a00d00b545b113c0c
parent98c0817b5335abf82a134287ad41d734dcf5bec2 (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 Change-Id: Id1aeecfbb43a25a887ebd5cc7242749a74290bb0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit dc65267ad8c086950c23185c8cebc304a8d1c3dc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/gui/image/qpixmapcache.cpp5
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)