mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-04 05:04:33 +00:00
Qt: Fix rare bug where covers get stuck in loading state
When quickly changing cover scale.
This commit is contained in:
@@ -126,6 +126,13 @@ public:
|
||||
Evict(m_items.size() - m_max_capacity);
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
void Apply(const F& func)
|
||||
{
|
||||
for (auto& [key, value] : m_items)
|
||||
func(const_cast<const K&>(key), value.value);
|
||||
}
|
||||
|
||||
private:
|
||||
void ShrinkForNewItem()
|
||||
{
|
||||
|
||||
@@ -278,6 +278,11 @@ void GameListModel::setCoverScale(float scale)
|
||||
|
||||
m_cover_scale = scale;
|
||||
|
||||
// Invalidate all pending loads. This stops the case where the user changes the scale,
|
||||
// then quickly changes back before the loads finish, resulting in the image never loading.
|
||||
m_cover_pixmap_cache.Apply(
|
||||
[](const std::string&, CoverPixmapCacheEntry& entry) { entry.scale = entry.is_loading ? 0.0f : entry.scale; });
|
||||
|
||||
Host::SetBaseFloatSettingValue("UI", "GameListCoverArtScale", scale);
|
||||
Host::CommitBaseSettingChanges();
|
||||
updateCoverScale();
|
||||
|
||||
Reference in New Issue
Block a user