Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed crash with multiple windows

  • Loading branch information
slouken committed Jul 23, 2006
1 parent b54cee1 commit 3f3ee25cd8bba634ef3a96080fe420746d71088d
Showing with 5 additions and 6 deletions.
  1. +1 −2 src/video/SDL_renderer_gl.c
  2. +1 −1 src/video/SDL_sysvideo.h
  3. +3 −3 src/video/SDL_video.c
@@ -199,8 +199,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
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;
}
}
@@ -397,7 +397,7 @@ extern SDL_bool SDL_AddDisplayMode(int displayIndex,
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);

@@ -843,16 +843,16 @@ SDL_CreateWindowFrom(const void *data)
}

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);
}

0 comments on commit 3f3ee25

Please sign in to comment.