From 3a08c3207b726a71e15784571e7c4677d25e3b3f Mon Sep 17 00:00:00 2001
From: Fernando Sahmkow <fsahmkow27@gmail.com>
Date: Tue, 7 May 2019 11:25:29 -0400
Subject: [PATCH] Correct possible error on Rasterizer Caches

There was a weird bug that could happen if the object died directly and
the cache address wasn't stored.
---
 src/video_core/rasterizer_cache.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/video_core/rasterizer_cache.h b/src/video_core/rasterizer_cache.h
index 291772186..185b6f414 100644
--- a/src/video_core/rasterizer_cache.h
+++ b/src/video_core/rasterizer_cache.h
@@ -147,8 +147,9 @@ protected:
 
         object->SetIsRegistered(false);
         rasterizer.UpdatePagesCachedCount(object->GetCpuAddr(), object->GetSizeInBytes(), -1);
+        const CacheAddr addr = object->GetCacheAddr();
         interval_cache.subtract({GetInterval(object), ObjectSet{object}});
-        map_cache.erase(object->GetCacheAddr());
+        map_cache.erase(addr);
     }
 
     /// Returns a ticks counter used for tracking when cached objects were last modified