QCache: fix accidental pessimization
By unconditionally removing the existing entry we never hit the if (result.initialized) branch. Change it to only remove the existing entry if we don't plan on inserting. Task-number: QTBUG-88183 Pick-to: 6.0 6.0.0 Change-Id: If4e7ebac23aa63d4b9d4b0a22882dd7d90a58e8b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
ae2c309420
commit
f08492c6fd
@ -236,10 +236,9 @@ public:
|
||||
|
||||
bool insert(const Key &key, T *object, qsizetype cost = 1)
|
||||
{
|
||||
remove(key);
|
||||
|
||||
if (cost > mx) {
|
||||
delete object;
|
||||
remove(key);
|
||||
return false;
|
||||
}
|
||||
trim(mx - cost);
|
||||
|
Loading…
Reference in New Issue
Block a user