Fixed crash with multiple windows
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401973
This commit is contained in:
parent
e06b514882
commit
1d8a5a2349
3 changed files with 5 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue