Fixed crash with multiple windows
authorSam Lantinga <slouken@libsdl.org>
Sun, 23 Jul 2006 00:19:12 +0000
changeset 1928 861bc36f0ab3
parent 1927 aeb8263d377a
child 1929 595ac54a8f9f
Fixed crash with multiple windows
src/video/SDL_renderer_gl.c
src/video/SDL_sysvideo.h
src/video/SDL_video.c
--- a/src/video/SDL_renderer_gl.c	Sat Jul 22 23:04:41 2006 +0000
+++ b/src/video/SDL_renderer_gl.c	Sun Jul 23 00:19:12 2006 +0000
@@ -199,8 +199,7 @@
     GL_RenderData *data;
 
     if (!(window->flags & SDL_WINDOW_OPENGL)) {
-        window->flags |= SDL_WINDOW_OPENGL;
-        if (SDL_RecreateWindow(window) < 0) {
+        if (SDL_RecreateWindow(window, window->flags | SDL_WINDOW_OPENGL) < 0) {
             return NULL;
         }
     }
--- a/src/video/SDL_sysvideo.h	Sat Jul 22 23:04:41 2006 +0000
+++ b/src/video/SDL_sysvideo.h	Sun Jul 23 00:19:12 2006 +0000
@@ -397,7 +397,7 @@
 extern void SDL_AddRenderDriver(int displayIndex,
                                 const SDL_RenderDriver * driver);
 
-extern int SDL_RecreateWindow(SDL_Window * window);
+extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
 extern SDL_Window *SDL_GetWindowFromID(SDL_WindowID windowID);
 extern SDL_VideoDisplay *SDL_GetDisplayFromWindow(SDL_Window * window);
 
--- a/src/video/SDL_video.c	Sat Jul 22 23:04:41 2006 +0000
+++ b/src/video/SDL_video.c	Sun Jul 23 00:19:12 2006 +0000
@@ -843,16 +843,16 @@
 }
 
 int
-SDL_RecreateWindow(SDL_Window * window)
+SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
 {
-    if ((window->flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
-        window->flags &= ~SDL_WINDOW_OPENGL;
+    if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
         SDL_SetError("No OpenGL support in video driver");
         return -1;
     }
     if (_this->DestroyWindow) {
         _this->DestroyWindow(_this, window);
     }
+    window->flags = flags;
     return _this->CreateWindow(_this, window);
 }