diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h index 4cfe4a4a48..7c065a8806 100644 --- a/src/corelib/tools/qcache.h +++ b/src/corelib/tools/qcache.h @@ -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);