Fix for Memory Leak Warning

I was getting rarely a Memory Leak Warning. I fixed it with this change to DrawingData. Since Unsafe collections are wrap raw unmanaged memory. Here’s the standard safe pattern:

C#


			public void Dispose () 
			{
				if (splitterOutput.IsCreated)
				{
					splitterOutput.Dispose();
				}

				if (vertices.IsCreated)
				{
					vertices.Dispose();
				}

				if (triangles.IsCreated)
				{
					triangles.Dispose();
				}

				if (solidVertices.IsCreated)
				{
					solidVertices.Dispose();
				}

				if (solidTriangles.IsCreated)
				{
					solidTriangles.Dispose();
				}

				if (textVertices.IsCreated)
				{
					textVertices.Dispose();
				}

				if (textTriangles.IsCreated)
				{
					textTriangles.Dispose();
				}

				if (capturedState.IsCreated)
				{
					capturedState.Dispose();
				}
			}

If you’re able to provide more context for this fix that may be helpful! Aron may know off-rip where this is at but just in case some context on what leak you’re referring to may be helpful. I tagged him on this to review regardless- thanks for the contribution!

Should be an easy fix it is in DrawingData. You need to check IsCreated because disposing an uninitialized unsafe collection can have undefined behavior or if you call Dispose () twice.

Appreciate it :+1: We’ll look into it.