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 - Crash in X11_GL_GetVisual (Patch attached)
Summary: Crash in X11_GL_GetVisual (Patch attached)
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 Linux
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-06 14:53 UTC by couriersud
Modified: 2008-08-25 19:50 UTC (History)
1 user (show)

See Also:


Attachments
Patch to solve issue (1.77 KB, patch)
2008-07-06 14:56 UTC, couriersud
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.