We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1009 - PATCH: Don't crash when trying to exit because of an xio-error
Summary: PATCH: Don't crash when trying to exit because of an xio-error
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 1.2.14
Hardware: Other Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-23 07:03 UTC by Hans de Goede
Modified: 2010-07-18 11:28 UTC (History)
0 users

See Also:


Attachments
PATCH: Don't crash when trying to exit because of an xio-error (1.08 KB, application/octet-stream)
2010-06-23 07:03 UTC, Hans de Goede
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hans de Goede 2010-06-23 07:03:18 UTC
Created attachment 511 [details]
PATCH:  Don't crash when trying to exit because of an xio-error

See the backtrace attached to this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=603984

What is happening here is:
1. an xio error happened while the mouse cursor was grabbed
2. SDL's xio error handler then sets SDL_Display to
3. SDL_VideoQuit calls SDL_WM_GrabInputOff, which ends up calling
   X11_GrabInputNoLock which causes a segfault trying to deref
   SDL_Display

The attached patch fixes this crash by checking for SDL_Display being NULL in
both X11_GrabInputNoLock() and X11_CheckMouseModeNoLock() (which will get
by called SDL_WM_GrabInputOff after X11_GrabInputNoLock(). I've audited the entire SDL_VideoQuit code path for further unchecked uses of SDL_Display and
could not find any.
Comment 1 Sam Lantinga 2010-07-18 11:28:35 UTC
This is fixed in revision a1af511bbbdd, thanks!