mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-02 00:15:06 +01:00
gl_rasterizer_cache: unlink watchers if surface is moved to remove_surfaces but is not immediately removed
This commit is contained in:
parent
777af04f4a
commit
ebdef4fd69
@ -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;
|
||||
|
@ -397,6 +397,16 @@ struct CachedSurface : SurfaceParams, std::enable_shared_from_this<CachedSurface
|
||||
}
|
||||
}
|
||||
|
||||
void UnlinkAllWatcher() {
|
||||
for (const auto& watcher : watchers) {
|
||||
if (auto locked = watcher.lock()) {
|
||||
locked->valid = false;
|
||||
locked->surface.reset();
|
||||
}
|
||||
}
|
||||
watchers.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
std::list<std::weak_ptr<SurfaceWatcher>> watchers;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user