From a02b7813473a19b23a5f15f156bd9d57793c7a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Wed, 30 Dec 2020 14:48:37 +0100 Subject: [PATCH] WindowsWindow now calls DestroyWindow --- GlitchyEngine/src/Platform/Windows/WindowsWindow.bf | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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); }