summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2018-11-08 11:52:17 +1000
committerStenzek <stenzek@gmail.com>2018-11-08 11:52:17 +1000
commit78056686fd69fba25a3047592a6b326a753ec00c (patch)
tree5fc6b3dcd0e0efd3cbaaec88258675b95b185b0b /Source/Core/VideoCommon/TextureCacheBase.cpp
parent16a618f413736590644caea7717ec6920c9c9ee0 (diff)
TextureCache: Fix leaking TCacheEntry instances
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 74d1d8a51e..d6b746ed9d 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -1923,13 +1923,12 @@ void TextureCacheBase::FlushEFBCopy(TCacheEntry* entry)
WriteEFBCopyToRAM(dst, entry->pending_efb_copy_width, entry->pending_efb_copy_height,
entry->memory_stride, std::move(entry->pending_efb_copy));
- // If the EFB copy was invalidated (e.g. the bloom case mentioned in InvalidateTexture),
- // now is the time to clean up the TCacheEntry. In which case, we don't need to compute
- // the new hash of the RAM copy.
+ // If the EFB copy was invalidated (e.g. the bloom case mentioned in InvalidateTexture), now is
+ // the time to clean up the TCacheEntry. In which case, we don't need to compute the new hash of
+ // the RAM copy. But we need to clean up the TCacheEntry, as InvalidateTexture doesn't free it.
if (entry->pending_efb_copy_invalidated)
{
- auto config = entry->texture->GetConfig();
- texture_pool.emplace(config, TexPoolEntry(std::move(entry->texture)));
+ delete entry;
return;
}
@@ -2137,13 +2136,16 @@ TextureCacheBase::InvalidateTexture(TexAddrCache::iterator iter, bool discard_pe
else
{
entry->pending_efb_copy_invalidated = true;
- return textures_by_address.erase(iter);
}
}
auto config = entry->texture->GetConfig();
texture_pool.emplace(config, TexPoolEntry(std::move(entry->texture)));
+ // Don't delete if there's a pending EFB copy, as we need the TCacheEntry alive.
+ if (!entry->pending_efb_copy)
+ delete entry;
+
return textures_by_address.erase(iter);
}