Fixed bug 1333 - segfault if opengl window could not get created

When the window couldn't be created, the normal window destruction process happens, which among other things, destroys the framebuffer, if any.
This commit is contained in:
Sam Lantinga 2012-01-07 22:52:41 -05:00
parent 305531d766
commit 79ef2d54f2
2 changed files with 13 additions and 1 deletions

View File

@ -113,6 +113,11 @@ void WIN_DestroyWindowFramebuffer(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
if (!data) {
/* The window wasn't fully initialized */
return;
}
if (data->mdc) {
DeleteDC(data->mdc);
data->mdc = NULL;

View File

@ -193,7 +193,14 @@ void
X11_DestroyWindowFramebuffer(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display = data->videodata->display;
Display *display;
if (!data) {
/* The window wasn't fully initialized */
return;
}
display = data->videodata->display;
if (data->ximage) {
XDestroyImage(data->ximage);