From d9ea718559a1b820278f7517be7b95a0d2263bd2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 8 Jan 2013 23:46:30 -0500 Subject: [PATCH] Fix an issue where an iterator would become invalidated in TextureCache::ClearRenderTargets() --- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index e3152455df..cfbd4eb6c8 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -204,12 +204,16 @@ void TextureCache::ClearRenderTargets() iter = textures.begin(), tcend = textures.end(); - for (; iter!=tcend; ++iter) + while (iter != tcend) + { if (iter->second->type == TCET_EC_VRAM) { delete iter->second; - textures.erase(iter); + textures.erase(iter++); } + else + ++iter; + } } bool TextureCache::CheckForCustomTextureLODs(u64 tex_hash, int texformat, unsigned int levels)