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

Commit

Permalink
Fixed bug 1333 - segfault if opengl window could not get created
Browse files Browse the repository at this point in the history
When the window couldn't be created, the normal window destruction process happens, which among other things, destroys the framebuffer, if any.
  • Loading branch information
slouken committed Jan 8, 2012
1 parent 9113776 commit 5537eba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/video/windows/SDL_windowsframebuffer.c
Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion src/video/x11/SDL_x11framebuffer.c
Expand Up @@ -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);
Expand Down

0 comments on commit 5537eba

Please sign in to comment.