diff --git a/Subsurface/Source/Map/Levels/Level.cs b/Subsurface/Source/Map/Levels/Level.cs index ef3f58c60..f91fa1cf8 100644 --- a/Subsurface/Source/Map/Levels/Level.cs +++ b/Subsurface/Source/Map/Levels/Level.cs @@ -1017,6 +1017,14 @@ namespace Barotrauma { renderer.Dispose(); renderer = null; + + for (int side = 0; side < 2; side++) + { + for (int i = 0; i < 2; i++) + { + wrappingWalls[side, i].Dispose(); + } + } cells = null; @@ -1025,6 +1033,8 @@ namespace Barotrauma loaded = null; + + //vertexBuffer.Dispose(); //vertexBuffer = null; } diff --git a/Subsurface/Source/Map/Levels/WrappingWall.cs b/Subsurface/Source/Map/Levels/WrappingWall.cs index c78d48eec..43accf309 100644 --- a/Subsurface/Source/Map/Levels/WrappingWall.cs +++ b/Subsurface/Source/Map/Levels/WrappingWall.cs @@ -10,9 +10,8 @@ using Voronoi2; namespace Barotrauma { - class WrappingWall + class WrappingWall : IDisposable { - public const float WallWidth = 20000.0f; private VertexBuffer wallVertices, bodyVertices; @@ -189,5 +188,18 @@ namespace Barotrauma midPos += moveAmount; offset += moveAmount; } + + public void Dispose() + { + Dispose(true); + + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + wallVertices.Dispose(); + bodyVertices.Dispose(); + } } }