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. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I339132d7bb2cb8a76f0f1feec37891d6131c4d7b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
e409d771d9
commit
588ca25e4a
@ -340,7 +340,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<QPixmapCache::Key, QPixmapCacheEntry>::insert(cacheKey, new QPixmapCacheEntry(cacheKey, pixmap), cost);
|
||||
if (success) {
|
||||
if (!theid) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user