Skip to content

Commit

Permalink
Clean up have-initialized resources in some failing edge cases.
Browse files Browse the repository at this point in the history
   Maybe fixes Bugzilla #426.
  • Loading branch information
icculus committed Jun 15, 2007
1 parent 5466454 commit 49d3956
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/video/x11/SDL_x11video.c
Expand Up @@ -408,7 +408,7 @@ static void create_aux_windows(_THIS)
}
}

/* Setup the communication with the IM server */
/* Setup the communication with the IM server */
SDL_IM = NULL;
SDL_IC = NULL;

Expand Down Expand Up @@ -483,6 +483,8 @@ static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat)
*/
GFX_Display = XOpenDisplay(display);
if ( GFX_Display == NULL ) {
XCloseDisplay(SDL_Display);
SDL_Display = NULL;
SDL_SetError("Couldn't open X11 display");
return(-1);
}
Expand All @@ -508,8 +510,13 @@ static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat)
#endif /* NO_SHARED_MEMORY */

/* Get the available video modes */
if(X11_GetVideoModes(this) < 0)
if(X11_GetVideoModes(this) < 0) {
XCloseDisplay(GFX_Display);
GFX_Display = NULL;
XCloseDisplay(SDL_Display);
SDL_Display = NULL;
return -1;
}

/* Determine the current screen size */
this->info.current_w = DisplayWidth(SDL_Display, SDL_Screen);
Expand Down

0 comments on commit 49d3956

Please sign in to comment.