diff --git a/GlitchyEngine/src/Platform/Windows/WindowsWindow.bf b/GlitchyEngine/src/Platform/Windows/WindowsWindow.bf index 15c7669..119ebc5 100644 --- a/GlitchyEngine/src/Platform/Windows/WindowsWindow.bf +++ b/GlitchyEngine/src/Platform/Windows/WindowsWindow.bf @@ -158,12 +158,21 @@ namespace GlitchyEngine Init(desc); } - + + [LinkName(.C)] + static extern Windows.IntBool DestroyWindow(Windows.HWnd hWnd); + [LinkName("UnregisterClassW")] static extern Windows.IntBool UnregisterClass(char16* className, Windows.HInstance hInstance); public ~this() { + if(!DestroyWindow(_windowHandle)) + { + HResult res = (.)GetLastError(); + Log.EngineLogger.Error($"Failed to destroy window: Message ({(int)res}): {res}"); + } + UnregisterClass(WindowClassName.ToScopedNativeWChar!(), _instanceHandle); }