From ebdef4fd6949a6e1e070575aa0ef73ac8164a076 Mon Sep 17 00:00:00 2001 From: wwylele Date: Tue, 24 Jul 2018 23:18:36 +0300 Subject: [PATCH] gl_rasterizer_cache: unlink watchers if surface is moved to remove_surfaces but is not immediately removed --- src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 1 + src/video_core/renderer_opengl/gl_rasterizer_cache.h | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 932a8ad9dd..66fbf23224 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -1300,6 +1300,7 @@ SurfaceRect_Tuple RasterizerCacheOpenGL::GetSurfaceSubRect(const SurfaceParams& // Delete the expanded surface, this can't be done safely yet // because it may still be in use + surface->UnlinkAllWatcher(); // unlink watchers as if this surface is already deleted remove_surfaces.emplace(surface); surface = new_surface; diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index f3dbdd8dda..962cbceb6f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -397,6 +397,16 @@ struct CachedSurface : SurfaceParams, std::enable_shared_from_thisvalid = false; + locked->surface.reset(); + } + } + watchers.clear(); + } + private: std::list> watchers; };