MakeCurrent(null) should make context non-current

This fixes the crash in the "GameWindow Threading" example.
This commit is contained in:
Stefanos A. 2013-10-01 22:13:33 +02:00
parent 2c867de1f4
commit 7460452b26

View file

@ -178,7 +178,7 @@ namespace OpenTK.Platform.SDL2
public override void MakeCurrent(IWindowInfo window) public override void MakeCurrent(IWindowInfo window)
{ {
var sdl_window = window as Sdl2WindowInfo; var sdl_window = window as Sdl2WindowInfo;
if (SDL.SDL_GL_MakeCurrent(sdl_window.Handle, SdlContext.Handle) < 0) if (SDL.SDL_GL_MakeCurrent(sdl_window != null ? sdl_window.Handle : IntPtr.Zero, SdlContext.Handle) < 0)
{ {
Debug.Print("SDL2 MakeCurrent failed with: {0}", SDL.SDL_GetError()); Debug.Print("SDL2 MakeCurrent failed with: {0}", SDL.SDL_GetError());
} }