Fixed crash initializing OpenGL ES renderer if OpenGL renderer fails

This commit is contained in:
Sam Lantinga 2014-06-22 02:30:36 -07:00
parent 5df11f8aa1
commit b7b6d8ab7a
5 changed files with 9 additions and 2 deletions

View File

@ -1402,7 +1402,7 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
if (_this->CreateWindow && !(flags & SDL_WINDOW_FOREIGN)) {
if (_this->CreateWindow(_this, window) < 0) {
if (flags & SDL_WINDOW_OPENGL) {
if ((flags & SDL_WINDOW_OPENGL) && !(window->flags & SDL_WINDOW_OPENGL)) {
SDL_GL_UnloadLibrary();
}
return -1;

View File

@ -1488,6 +1488,8 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
window->driverdata = NULL;
if (data) {
[data->listener close];
[data->listener release];

View File

@ -289,11 +289,13 @@ void
UIKit_DestroyWindow(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
window->driverdata = NULL;
if (data) {
[data->viewcontroller release];
[data->uiwindow release];
SDL_free(data);
window->driverdata = NULL;
}
}

View File

@ -619,6 +619,8 @@ WIN_DestroyWindow(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
window->driverdata = NULL;
if (data) {
ReleaseDC(data->hwnd, data->hdc);
if (data->created) {

View File

@ -1393,6 +1393,7 @@ void
X11_DestroyWindow(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
window->driverdata = NULL;
if (data) {