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 13:15:53 +0000 (14:15 +0100)
MakeCurrent(null) should set the bound device context to zero.

Source/OpenTK/Platform/Windows/WinGLContext.cs

index 0e727df7d7cc558bc5fa3aa8b9907c256e09fd3b..837c3e76041c980e05a9802a67a82256d7332238 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(