From 9bdc21cabdc3d7bc68e4c9d1dce1fe93621e9357 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Tue, 19 May 2009 09:45:36 +0000 Subject: [PATCH] Added diagnostic message when ReleaseDC fails. --- Source/OpenTK/Platform/Windows/WinWindowInfo.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/OpenTK/Platform/Windows/WinWindowInfo.cs b/Source/OpenTK/Platform/Windows/WinWindowInfo.cs index 33d9414f..b192cb8d 100644 --- a/Source/OpenTK/Platform/Windows/WinWindowInfo.cs +++ b/Source/OpenTK/Platform/Windows/WinWindowInfo.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Text; +using System.Diagnostics; +using System.Runtime.InteropServices; namespace OpenTK.Platform.Windows { @@ -95,7 +97,8 @@ namespace OpenTK.Platform.Windows if (!disposed) { if (this.dc != IntPtr.Zero) - Functions.ReleaseDC(this.handle, this.dc); + if (!Functions.ReleaseDC(this.handle, this.dc)) + Debug.Print("[Warning] Failed to release device context {0}. Windows error: {1}.", this.dc, Marshal.GetLastWin32Error()); if (manual) {