Fixed crash with multiple windows
authorSam Lantinga <slouken@libsdl.org>
Sun, 23 Jul 2006 00:19:12 +0000
changeset 1928861bc36f0ab3
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
     1.1 --- a/src/video/SDL_renderer_gl.c	Sat Jul 22 23:04:41 2006 +0000
     1.2 +++ b/src/video/SDL_renderer_gl.c	Sun Jul 23 00:19:12 2006 +0000
     1.3 @@ -199,8 +199,7 @@
     1.4      GL_RenderData *data;
     1.5  
     1.6      if (!(window->flags & SDL_WINDOW_OPENGL)) {
     1.7 -        window->flags |= SDL_WINDOW_OPENGL;
     1.8 -        if (SDL_RecreateWindow(window) < 0) {
     1.9 +        if (SDL_RecreateWindow(window, window->flags | SDL_WINDOW_OPENGL) < 0) {
    1.10              return NULL;
    1.11          }
    1.12      }
     2.1 --- a/src/video/SDL_sysvideo.h	Sat Jul 22 23:04:41 2006 +0000
     2.2 +++ b/src/video/SDL_sysvideo.h	Sun Jul 23 00:19:12 2006 +0000
     2.3 @@ -397,7 +397,7 @@
     2.4  extern void SDL_AddRenderDriver(int displayIndex,
     2.5                                  const SDL_RenderDriver * driver);
     2.6  
     2.7 -extern int SDL_RecreateWindow(SDL_Window * window);
     2.8 +extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
     2.9  extern SDL_Window *SDL_GetWindowFromID(SDL_WindowID windowID);
    2.10  extern SDL_VideoDisplay *SDL_GetDisplayFromWindow(SDL_Window * window);
    2.11  
     3.1 --- a/src/video/SDL_video.c	Sat Jul 22 23:04:41 2006 +0000
     3.2 +++ b/src/video/SDL_video.c	Sun Jul 23 00:19:12 2006 +0000
     3.3 @@ -843,16 +843,16 @@
     3.4  }
     3.5  
     3.6  int
     3.7 -SDL_RecreateWindow(SDL_Window * window)
     3.8 +SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
     3.9  {
    3.10 -    if ((window->flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
    3.11 -        window->flags &= ~SDL_WINDOW_OPENGL;
    3.12 +    if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
    3.13          SDL_SetError("No OpenGL support in video driver");
    3.14          return -1;
    3.15      }
    3.16      if (_this->DestroyWindow) {
    3.17          _this->DestroyWindow(_this, window);
    3.18      }
    3.19 +    window->flags = flags;
    3.20      return _this->CreateWindow(_this, window);
    3.21  }
    3.22