Fixed bug 1256 - Invalid window warning in GL_CreateRenderer
authorSam Lantinga <slouken@libsdl.org>
Sat, 07 Jan 2012 02:32:08 -0500
changeset 6171 7b9126fde949
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
--- a/src/render/opengl/SDL_render_gl.c	Sat Jan 07 02:04:38 2012 -0500
+++ b/src/render/opengl/SDL_render_gl.c	Sat Jan 07 02:32:08 2012 -0500
@@ -274,6 +274,7 @@
     renderer->info = GL_RenderDriver.info;
     renderer->info.flags = SDL_RENDERER_ACCELERATED;
     renderer->driverdata = data;
+    renderer->window = window;
 
     data->context = SDL_GL_CreateContext(window);
     if (!data->context) {
--- a/src/render/opengles/SDL_render_gles.c	Sat Jan 07 02:04:38 2012 -0500
+++ b/src/render/opengles/SDL_render_gles.c	Sat Jan 07 02:32:08 2012 -0500
@@ -225,6 +225,7 @@
     renderer->info = GLES_RenderDriver.info;
     renderer->info.flags = SDL_RENDERER_ACCELERATED;
     renderer->driverdata = data;
+    renderer->window = window;
 
     SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
     SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
--- a/src/render/opengles2/SDL_render_gles2.c	Sat Jan 07 02:04:38 2012 -0500
+++ b/src/render/opengles2/SDL_render_gles2.c	Sat Jan 07 02:32:08 2012 -0500
@@ -1211,6 +1211,7 @@
     renderer->info = GLES2_RenderDriver.info;
     renderer->info.flags = SDL_RENDERER_ACCELERATED;
     renderer->driverdata = rdata;
+    renderer->window = window;
 
     /* Create an OpenGL ES 2.0 context */
     SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);