diff -up SDL-1.2.14/src/video/x11/SDL_x11mouse.c~ SDL-1.2.14/src/video/x11/SDL_x11mouse.c --- SDL-1.2.14/src/video/x11/SDL_x11mouse.c~ 2009-10-13 01:07:15.000000000 +0200 +++ SDL-1.2.14/src/video/x11/SDL_x11mouse.c 2010-06-23 14:16:34.730381512 +0200 @@ -230,6 +230,10 @@ void X11_CheckMouseModeNoLock(_THIS) char *env_override; int enable_relative = 1; + /* This happens when quiting after an xio error */ + if ( SDL_Display == NULL ) + return; + /* Allow the user to override the relative mouse mode. They almost never want to do this, as it seriously affects applications that rely on continuous relative mouse motion. diff -up SDL-1.2.14/src/video/x11/SDL_x11wm.c~ SDL-1.2.14/src/video/x11/SDL_x11wm.c --- SDL-1.2.14/src/video/x11/SDL_x11wm.c~ 2009-10-13 01:07:15.000000000 +0200 +++ SDL-1.2.14/src/video/x11/SDL_x11wm.c 2010-06-23 14:11:55.596629337 +0200 @@ -329,7 +329,7 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, { int result; - if ( this->screen == NULL ) { + if ( this->screen == NULL || SDL_Display == NULL ) { return(SDL_GRAB_OFF); } if ( ! SDL_Window ) {