jsut a overflow protection

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-11-02 01:19:18 +02:00
parent ea7dd9cfcc
commit 2349f29be0
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318

View File

@ -113,7 +113,13 @@ class PixmapCache final : public QObject {
if (m_consecutive_fast_evicitons >= m_consecutive_fast_evicitons_threshold) {
// double the cache size
auto newSize = _cacheLimit() * 2;
qDebug() << m_consecutive_fast_evicitons << "pixmap cache misses by eviction happened too fast, doubling cache size to"
if (newSize <= 0) { // double it until you overflow :D
qDebug() << m_consecutive_fast_evicitons
<< tr("pixmap cache misses by eviction happened too fast, doing nothing as the cache size reached it's limit");
m_consecutive_fast_evicitons = 0;
return true;
}
qDebug() << m_consecutive_fast_evicitons << tr("pixmap cache misses by eviction happened too fast, doubling cache size to")
<< newSize;
_setCacheLimit(newSize);
m_consecutive_fast_evicitons = 0;