Fixed crash in MakeCurrent(null)

MakeCurrent(null) should set the bound device context to zero.
This commit is contained in:
Stefanos A. 2013-12-22 11:10:05 +01:00
parent 0a46e20029
commit 30cd9cb7f8

View file

@ -279,14 +279,14 @@ namespace OpenTK.Platform.Windows
throw new ArgumentException("window", "Must point to a valid window."); throw new ArgumentException("window", "Must point to a valid window.");
success = Wgl.MakeCurrent(wnd.DeviceContext, Handle.Handle); success = Wgl.MakeCurrent(wnd.DeviceContext, Handle.Handle);
device_context = wnd.DeviceContext;
} }
else else
{ {
success = Wgl.MakeCurrent(IntPtr.Zero, IntPtr.Zero); success = Wgl.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
device_context = IntPtr.Zero;
} }
device_context = wnd.DeviceContext;
if (!success) if (!success)
{ {
throw new GraphicsContextException(String.Format( throw new GraphicsContextException(String.Format(