made sure that we do not relay for undefined behavior
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
2349f29be0
commit
220a1de99a
@ -5,6 +5,7 @@
|
|||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#define GET_TYPE() \
|
#define GET_TYPE() \
|
||||||
Qt::ConnectionType type; \
|
Qt::ConnectionType type; \
|
||||||
@ -112,16 +113,16 @@ class PixmapCache final : public QObject {
|
|||||||
m_last_cache_miss_by_eviciton = now;
|
m_last_cache_miss_by_eviciton = now;
|
||||||
if (m_consecutive_fast_evicitons >= m_consecutive_fast_evicitons_threshold) {
|
if (m_consecutive_fast_evicitons >= m_consecutive_fast_evicitons_threshold) {
|
||||||
// double the cache size
|
// double the cache size
|
||||||
auto newSize = _cacheLimit() * 2;
|
auto newSize = _cacheLimit() * 2.L;
|
||||||
if (newSize <= 0) { // double it until you overflow :D
|
if (newSize >= std::numeric_limits<int>::max()) { // double it until you overflow :D
|
||||||
|
newSize = std::numeric_limits<int>::max();
|
||||||
qDebug() << m_consecutive_fast_evicitons
|
qDebug() << m_consecutive_fast_evicitons
|
||||||
<< tr("pixmap cache misses by eviction happened too fast, doing nothing as the cache size reached it's limit");
|
<< tr("pixmap cache misses by eviction happened too fast, doing nothing as the cache size reached it's limit");
|
||||||
m_consecutive_fast_evicitons = 0;
|
} else {
|
||||||
return true;
|
qDebug() << m_consecutive_fast_evicitons << tr("pixmap cache misses by eviction happened too fast, doubling cache size to")
|
||||||
|
<< static_cast<int>(newSize);
|
||||||
}
|
}
|
||||||
qDebug() << m_consecutive_fast_evicitons << tr("pixmap cache misses by eviction happened too fast, doubling cache size to")
|
_setCacheLimit(static_cast<int>(newSize));
|
||||||
<< newSize;
|
|
||||||
_setCacheLimit(newSize);
|
|
||||||
m_consecutive_fast_evicitons = 0;
|
m_consecutive_fast_evicitons = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user