• Sam Lantinga's avatar
    Couriersud fixed bug #603 · 4dd047e9
    Sam Lantinga authored
    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.
    
    --HG--
    extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403174
    4dd047e9
SDL_x11opengl.c 15.7 KB