From 5f5da5cf289f18f890c1ff3a97980e38ce175cf2 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 7 Jun 2023 07:29:31 +0200 Subject: [PATCH] QPixmapCache: add a comment on how failed insert() invalidates cacheKey It wasn't obvious to me, at least, and I only found out about it when I failed to construct a test failure based on this. Change-Id: I339132d7bb2cb8a76f0f1feec37891d6131c4d7b Reviewed-by: Volker Hilsheimer (cherry picked from commit 588ca25e4a31642bf8d18cd1948c50fa514ac0a7) Reviewed-by: Qt Cherry-pick Bot --- src/gui/image/qpixmapcache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 52d4439b5de..8e0a031c390 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -370,7 +370,7 @@ bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost) QPixmapCache::Key QPMCache::insert(const QPixmap &pixmap, int cost) { - QPixmapCache::Key cacheKey = createKey(); + QPixmapCache::Key cacheKey = createKey(); // invalidated by ~QPixmapCacheEntry on failed insert bool success = QCache::insert(cacheKey, new QPixmapCacheEntry(cacheKey, pixmap), cost); if (success) { if (!theid) {