From 163a2f1a1076d518b04ee37911bdd40afe8b9b2c Mon Sep 17 00:00:00 2001 From: Sarah B Date: Sat, 20 Jan 2024 15:28:48 -0800 Subject: Added finalizers --- Bitmap.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Bitmap.cs') diff --git a/Bitmap.cs b/Bitmap.cs index 0575497..91eabb9 100644 --- a/Bitmap.cs +++ b/Bitmap.cs @@ -123,8 +123,15 @@ class Bitmap : IDisposable return SerializedData; } + bool disposed = false; + public void Dispose() { + if (disposed) return; Raylib.UnloadTexture(Texture); + GC.SuppressFinalize(this); + disposed = true; } + + ~Bitmap() => Dispose(); } \ No newline at end of file -- cgit