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 603

Summary: Crash in X11_GL_GetVisual (Patch attached)
Product: SDL Reporter: couriersud
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: couriersud
Version: HG 2.0   
Hardware: x86   
OS: Linux   
Attachments: Patch to solve issue

Description couriersud 2008-07-06 14:53:17 UTC
Using the following sequence

SDL_Init(..:)
SDL_CreateWindow(..., SDL_WINDOW_OPENGL)
SDL_DestroyWindow
SDL_CreateWindow(..., SDL_WINDOW_OPENGL)

SDL will crash in X11_GL_GetVisual. This is due to the fact that 
during SDL_DestroyWindow X11_GL_Shutdown was called because the last window 
has been closed.

On the next call to SDL_CreateWindow the library is still loaded and only the memory is reinitialized. Function pointers such as gl_data->glXChooseVisual will not be reinitialized.

Consequently, SDL will crash due to a NULL pointer access.

The attached patch corrects the behaviour.
Comment 1 couriersud 2008-07-06 14:56:11 UTC
Created attachment 257 [details]
Patch to solve issue
Comment 2 Sam Lantinga 2008-08-25 19:50:36 UTC
Thanks!

Committed revision 4047.