Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed crash with multiple windows
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 23, 2006
1 parent b54cee1 commit 3f3ee25
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/video/SDL_renderer_gl.c
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/video/SDL_sysvideo.h
Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions src/video/SDL_video.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit 3f3ee25

Please sign in to comment.