Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11video.c @ 3964:3dc92ff218dd SDL-1.2
Clean up have-initialized resources in some failing edge cases.
Maybe fixes Bugzilla #426.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Fri, 15 Jun 2007 06:57:31 +0000 |
parents | c5c3c772f5aa |
children | b966761fef6c |
comparison
equal
deleted
inserted
replaced
3963:a9ad5257f794 | 3964:3dc92ff218dd |
---|---|
406 XSetClassHint(SDL_Display, WMwindow, classhints); | 406 XSetClassHint(SDL_Display, WMwindow, classhints); |
407 XFree(classhints); | 407 XFree(classhints); |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
411 /* Setup the communication with the IM server */ | 411 /* Setup the communication with the IM server */ |
412 SDL_IM = NULL; | 412 SDL_IM = NULL; |
413 SDL_IC = NULL; | 413 SDL_IC = NULL; |
414 | 414 |
415 #ifdef X_HAVE_UTF8_STRING | 415 #ifdef X_HAVE_UTF8_STRING |
416 if (SDL_X11_HAVE_UTF8) { | 416 if (SDL_X11_HAVE_UTF8) { |
481 to do graphics updates in a separate thread from event handling. | 481 to do graphics updates in a separate thread from event handling. |
482 Thread-safe X11 doesn't seem to exist. | 482 Thread-safe X11 doesn't seem to exist. |
483 */ | 483 */ |
484 GFX_Display = XOpenDisplay(display); | 484 GFX_Display = XOpenDisplay(display); |
485 if ( GFX_Display == NULL ) { | 485 if ( GFX_Display == NULL ) { |
486 XCloseDisplay(SDL_Display); | |
487 SDL_Display = NULL; | |
486 SDL_SetError("Couldn't open X11 display"); | 488 SDL_SetError("Couldn't open X11 display"); |
487 return(-1); | 489 return(-1); |
488 } | 490 } |
489 | 491 |
490 /* Set the normal X error handler */ | 492 /* Set the normal X error handler */ |
506 use_mitshm = XShmQueryExtension(SDL_Display); | 508 use_mitshm = XShmQueryExtension(SDL_Display); |
507 } | 509 } |
508 #endif /* NO_SHARED_MEMORY */ | 510 #endif /* NO_SHARED_MEMORY */ |
509 | 511 |
510 /* Get the available video modes */ | 512 /* Get the available video modes */ |
511 if(X11_GetVideoModes(this) < 0) | 513 if(X11_GetVideoModes(this) < 0) { |
514 XCloseDisplay(GFX_Display); | |
515 GFX_Display = NULL; | |
516 XCloseDisplay(SDL_Display); | |
517 SDL_Display = NULL; | |
512 return -1; | 518 return -1; |
519 } | |
513 | 520 |
514 /* Determine the current screen size */ | 521 /* Determine the current screen size */ |
515 this->info.current_w = DisplayWidth(SDL_Display, SDL_Screen); | 522 this->info.current_w = DisplayWidth(SDL_Display, SDL_Screen); |
516 this->info.current_h = DisplayHeight(SDL_Display, SDL_Screen); | 523 this->info.current_h = DisplayHeight(SDL_Display, SDL_Screen); |
517 | 524 |