Skip to content

Fix a crash in process termination when EGL and GLX are both loaded.

Kyle Brenneman requested to merge github/fork/kbrenneman/fix-issue-103 into master

Created by: kbrenneman

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

Merge request reports

Loading