From e571f25187ef53ce41aa46bec6d7d2903ee51170 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 12 Jul 2017 14:03:35 -0400 Subject: [PATCH 3/5] dispatch: Use epoxy_conservative_glx_dlsym when probing GLX This path should also only load libGLX.so if possible. Signed-off-by: Adam Jackson (cherry picked from commit f81274b12470a0ce8678465112998708f63c3559) --- src/dispatch_common.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/dispatch_common.c b/src/dispatch_common.c index a7c2f74..48bd3f5 100644 --- a/src/dispatch_common.c +++ b/src/dispatch_common.c @@ -500,6 +500,18 @@ epoxy_internal_has_gl_extension(const char *ext, bool invalid_op_mode) } } +void * +epoxy_conservative_glx_dlsym(const char *name, bool exit_if_fails) +{ +#ifdef GLVND_GLX_LIB + /* prefer the glvnd library if it exists */ + if (!api.glx_handle) + get_dlopen_handle(&api.glx_handle, GLVND_GLX_LIB, false); +#endif + + return do_dlsym(&api.glx_handle, GLX_LIB, name, exit_if_fails); +} + /** * Tests whether the currently bound context is EGL or GLX, trying to * avoid loading libraries unless necessary. @@ -541,7 +553,7 @@ epoxy_current_context_is_glx(void) * Presumably they dlopened with RTLD_LOCAL, which hides it * from us. Just go dlopen()ing likely libraries and try them. */ - sym = do_dlsym(&api.glx_handle, GLX_LIB, "glXGetCurrentContext", false); + sym = epoxy_conservative_glx_dlsym("glXGetCurrentContext", false); if (sym && glXGetCurrentContext()) return true; @@ -595,18 +607,6 @@ epoxy_egl_dlsym(const char *name) } void * -epoxy_conservative_glx_dlsym(const char *name, bool exit_if_fails) -{ -#ifdef GLVND_GLX_LIB - /* prefer the glvnd library if it exists */ - if (!api.glx_handle) - get_dlopen_handle(&api.glx_handle, GLVND_GLX_LIB, false); -#endif - - return do_dlsym(&api.glx_handle, GLX_LIB, name, exit_if_fails); -} - -void * epoxy_glx_dlsym(const char *name) { return epoxy_conservative_glx_dlsym(name, true); -- 2.13.5