Commit 1dafe0e9 authored by Sam Lantinga's avatar Sam Lantinga

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.
parent 5258e42d
...@@ -113,6 +113,11 @@ void WIN_DestroyWindowFramebuffer(_THIS, SDL_Window * window) ...@@ -113,6 +113,11 @@ void WIN_DestroyWindowFramebuffer(_THIS, SDL_Window * window)
{ {
SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
if (!data) {
/* The window wasn't fully initialized */
return;
}
if (data->mdc) { if (data->mdc) {
DeleteDC(data->mdc); DeleteDC(data->mdc);
data->mdc = NULL; data->mdc = NULL;
......
...@@ -193,7 +193,14 @@ void ...@@ -193,7 +193,14 @@ void
X11_DestroyWindowFramebuffer(_THIS, SDL_Window * window) X11_DestroyWindowFramebuffer(_THIS, SDL_Window * window)
{ {
SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 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) { if (data->ximage) {
XDestroyImage(data->ximage); XDestroyImage(data->ximage);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment