mirror of
https://github.com/yawut/SDL.git
synced 2026-07-24 03:42:12 -05:00
Fixed crash with multiple windows
This commit is contained in:
parent
ef12c290da
commit
44935b57ae
|
|
@ -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…
Reference in New Issue
Block a user