Fixed crash in MakeCurrent(null)
authorStefanos A. <stapostol@gmail.com>
Sun, 22 Dec 2013 10:10:05 +0000 (11:10 +0100)
committerStefanos A. <stapostol@gmail.com>
Sun, 22 Dec 2013 10:10:05 +0000 (11:10 +0100)
MakeCurrent(null) should set the bound device context to zero.

Source/OpenTK/Platform/Windows/WinGLContext.cs

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