src/video/SDL_video.c
changeset 7091 ff07fad908f8
parent 7089 257fc4e541e1
child 7107 2fcf7bf1d2b2
     1.1 --- a/src/video/SDL_video.c	Mon Apr 22 18:15:00 2013 -0700
     1.2 +++ b/src/video/SDL_video.c	Mon Apr 22 18:15:08 2013 -0700
     1.3 @@ -2690,13 +2690,14 @@
     1.4  {
     1.5      int retval;
     1.6  
     1.7 -    CHECK_WINDOW_MAGIC(window, -1);
     1.8 -
     1.9 -    if (!(window->flags & SDL_WINDOW_OPENGL)) {
    1.10 -        return SDL_SetError("The specified window isn't an OpenGL window");
    1.11 -    }
    1.12      if (!ctx) {
    1.13          window = NULL;
    1.14 +    } else {
    1.15 +        CHECK_WINDOW_MAGIC(window, -1);
    1.16 +
    1.17 +        if (!(window->flags & SDL_WINDOW_OPENGL)) {
    1.18 +            return SDL_SetError("The specified window isn't an OpenGL window");
    1.19 +        }
    1.20      }
    1.21  
    1.22      if ((window == _this->current_glwin) && (ctx == _this->current_glctx)) {
    1.23 @@ -2758,7 +2759,11 @@
    1.24      if (!_this || !context) {
    1.25          return;
    1.26      }
    1.27 -    _this->GL_MakeCurrent(_this, NULL, NULL);
    1.28 +
    1.29 +    if (_this->current_glctx == context) {
    1.30 +        SDL_GL_MakeCurrent(NULL, NULL);
    1.31 +    }
    1.32 +
    1.33      _this->GL_DeleteContext(_this, context);
    1.34  }
    1.35