src/video/SDL_video.c
changeset 7390 e4b98404baa4
parent 7360 b86947ea2749
child 7399 f35ff854121a
     1.1 --- a/src/video/SDL_video.c	Tue Jul 09 12:57:12 2013 -0700
     1.2 +++ b/src/video/SDL_video.c	Tue Jul 09 12:58:54 2013 -0700
     1.3 @@ -2730,6 +2730,7 @@
     1.4      /* Creating a context is assumed to make it current in the SDL driver. */
     1.5      _this->current_glwin = window;
     1.6      _this->current_glctx = ctx;
     1.7 +    _this->current_glthread = SDL_ThreadID();
     1.8  
     1.9      return ctx;
    1.10  }
    1.11 @@ -2738,6 +2739,7 @@
    1.12  SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext ctx)
    1.13  {
    1.14      int retval;
    1.15 +    SDL_threadID thread = SDL_ThreadID();
    1.16  
    1.17      if (!ctx) {
    1.18          window = NULL;
    1.19 @@ -2749,13 +2751,14 @@
    1.20          }
    1.21      }
    1.22  
    1.23 -    if ((window == _this->current_glwin) && (ctx == _this->current_glctx)) {
    1.24 +    if ((window == _this->current_glwin) && (ctx == _this->current_glctx) && (thread == _this->current_glthread)) {
    1.25          retval = 0;  /* we're already current. */
    1.26      } else {
    1.27          retval = _this->GL_MakeCurrent(_this, window, ctx);
    1.28          if (retval == 0) {
    1.29              _this->current_glwin = window;
    1.30              _this->current_glctx = ctx;
    1.31 +            _this->current_glthread = thread;
    1.32          }
    1.33      }
    1.34