Skip to content
  • Kyle Brenneman's avatar
    Fix a crash in process termination when EGL and GLX are both loaded. · 61bd107c
    Kyle Brenneman authored
    Added a new function to libGLdispatch, __glDispatchForceUnpatch, which forces
    it to unpatch the OpenGL entrypoints before libEGL or libGLX can unload the
    vendor library that patched them.
    
    If a vendor patches the OpenGL entrypoints, libGLdispatch doesn't unpatch them
    when that vendor's context is no longer current, because that adds too much
    overhead to repeated MakeCurrent+LoseCurrent calls. But, that also means that
    the patch callbacks end up being dangling pointers after the vendor library is
    unloaded.
    
    This mainly shows up at process termination when a process loads both libEGL
    and libGLX, because __glxFini and __eglFini will both call the vendor's
    threadAttach callback.
    
    Fixes https://github.com/NVIDIA/libglvnd/issues/103
    61bd107c