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

Merged
merged 1 commit into from Oct 25, 2016

Conversation

Projects
None yet
3 participants
Contributor

kbrenneman commented Oct 24, 2016

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 #103

Fix a crash in process termination when EGL and GLX are both loaded.
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 #103

This seems reasonable to me. I imagine this could also be triggered by dlclosing libGLX and libEGL, in addition to process termination.

@kbrenneman kbrenneman merged commit 28867bb into NVIDIA:master Oct 25, 2016

@kbrenneman kbrenneman deleted the kbrenneman:fix-issue-103 branch Oct 25, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment