fix: prevent inf recursion when mod icon load fails; cut max pixmapcache to 1/4 previous value

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers
2024-10-11 13:26:20 -07:00
parent 0c4c86c41f
commit 09c9da268f
5 changed files with 55 additions and 45 deletions

View File

@ -82,7 +82,7 @@ class Mod : public Resource {
/** Gets the icon of the mod, converted to a QPixmap for drawing, and scaled to size. */
[[nodiscard]] QPixmap icon(QSize size, Qt::AspectRatioMode mode = Qt::AspectRatioMode::IgnoreAspectRatio) const;
/** Thread-safe. */
void setIcon(QImage new_image) const;
QPixmap setIcon(QImage new_image) const;
auto metadata() -> std::shared_ptr<Metadata::ModStruct>;
auto metadata() const -> const std::shared_ptr<Metadata::ModStruct>;
@ -111,7 +111,7 @@ class Mod : public Resource {
struct {
QPixmapCache::Key key;
bool was_ever_used = false;
bool was_read_attempt = false;
} mutable m_pack_image_cache_key;
bool wasEverUsed = false;
bool wasReadAttempt = false;
} mutable m_packImageCacheKey;
};