Fixed bug 1256 - Invalid window warning in GL_CreateRenderer
authorSam Lantinga
Sat, 07 Jan 2012 02:32:08 -0500
changeset 61717b9126fde949
parent 6168 47dc1acea66f
child 6172 062ce1e65f6e
Fixed bug 1256 - Invalid window warning in GL_CreateRenderer

Martin Gerhardy 2011-07-27 02:26:06 PDT
the window reference is lost in the GL_CreateRenderer function. The attached
patch should fix this error.

#0 SDLSystem_LogOutputFunction (userdata=0x63b010, category=1,
priority=SDL_LOG_PRIORITY_ERROR, message=0x7fffffffcd00 "Invalid window") at
src/system/sdl/SDLSystem.cpp:8
#1 0x00007ffff7b1ddb3 in SDL_LogMessageV (category=1,
priority=SDL_LOG_PRIORITY_ERROR, fmt=<value optimized out>, ap=<value optimized
out>) at src/SDL_log.c:275
#2 0x00007ffff7b1df7c in SDL_LogError (category=<value optimized out>,
fmt=<value optimized out>) at src/SDL_log.c:212
#3 0x00007ffff7b1d582 in SDL_SetError (fmt=0x7ffff7baaff0 "") at
src/SDL_error.c:111
#4 0x00007ffff7b96f9e in SDL_GL_MakeCurrent (window=0x0, ctx=0xa62ce0) at
src/video/SDL_video.c:2484
#5 0x00007ffff7b4ba0c in GL_ActivateRenderer (renderer=0xa8f680) at
src/render/opengl/SDL_render_gl.c:195
#6 0x00007ffff7b4c59a in GL_ResetState (window=0x918010, flags=<value
optimized out>) at src/render/opengl/SDL_render_gl.c:214
#7 GL_CreateRenderer (window=0x918010, flags=<value optimized out>) at
src/render/opengl/SDL_render_gl.c:343
#8 0x00007ffff7b48053 in SDL_CreateRenderer (window=0x918010, index=<value
optimized out>, flags=2) at src/render/SDL_render.c:166
src/render/opengl/SDL_render_gl.c
src/render/opengles/SDL_render_gles.c
src/render/opengles2/SDL_render_gles2.c
     1.1 --- a/src/render/opengl/SDL_render_gl.c	Sat Jan 07 02:04:38 2012 -0500
     1.2 +++ b/src/render/opengl/SDL_render_gl.c	Sat Jan 07 02:32:08 2012 -0500
     1.3 @@ -274,6 +274,7 @@
     1.4      renderer->info = GL_RenderDriver.info;
     1.5      renderer->info.flags = SDL_RENDERER_ACCELERATED;
     1.6      renderer->driverdata = data;
     1.7 +    renderer->window = window;
     1.8  
     1.9      data->context = SDL_GL_CreateContext(window);
    1.10      if (!data->context) {
     2.1 --- a/src/render/opengles/SDL_render_gles.c	Sat Jan 07 02:04:38 2012 -0500
     2.2 +++ b/src/render/opengles/SDL_render_gles.c	Sat Jan 07 02:32:08 2012 -0500
     2.3 @@ -225,6 +225,7 @@
     2.4      renderer->info = GLES_RenderDriver.info;
     2.5      renderer->info.flags = SDL_RENDERER_ACCELERATED;
     2.6      renderer->driverdata = data;
     2.7 +    renderer->window = window;
     2.8  
     2.9      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
    2.10      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
     3.1 --- a/src/render/opengles2/SDL_render_gles2.c	Sat Jan 07 02:04:38 2012 -0500
     3.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Sat Jan 07 02:32:08 2012 -0500
     3.3 @@ -1211,6 +1211,7 @@
     3.4      renderer->info = GLES2_RenderDriver.info;
     3.5      renderer->info.flags = SDL_RENDERER_ACCELERATED;
     3.6      renderer->driverdata = rdata;
     3.7 +    renderer->window = window;
     3.8  
     3.9      /* Create an OpenGL ES 2.0 context */
    3.10      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);