summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2018-11-09 04:27:14 +0100
committerGitHub <noreply@github.com>2018-11-09 04:27:14 +0100
commite903d346ea6fefc967f87a4dfc06acdf97acc00f (patch)
tree3ece2f5c5a36e9e252c6a0160b583fd4b2e112d2 /Source/Core/VideoCommon/TextureCacheBase.cpp
parent4271a0ab9763c86292ce81a8af0d6fd76108e2bc (diff)
parent78056686fd69fba25a3047592a6b326a753ec00c (diff)
Merge pull request #7552 from stenzek/texture-cache-leak
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);
}