From 08737bdc023f2cd7e8b11a0437ad6fc92f9f99c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 16 Aug 2017 21:12:48 +0200 Subject: [PATCH] X11: Close extension libraries after XCloseDisplay --- src/x11_init.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/x11_init.c b/src/x11_init.c index f2c6ae06..3bae1fa3 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -896,30 +896,6 @@ int _glfwPlatformInit(void) void _glfwPlatformTerminate(void) { - if (_glfw.x11.x11xcb.handle) - { - dlclose(_glfw.x11.x11xcb.handle); - _glfw.x11.x11xcb.handle = NULL; - } - - if (_glfw.x11.randr.handle) - { - dlclose(_glfw.x11.randr.handle); - _glfw.x11.randr.handle = NULL; - } - - if (_glfw.x11.xcursor.handle) - { - dlclose(_glfw.x11.xcursor.handle); - _glfw.x11.xcursor.handle = NULL; - } - - if (_glfw.x11.xinerama.handle) - { - dlclose(_glfw.x11.xinerama.handle); - _glfw.x11.xinerama.handle = NULL; - } - if (_glfw.x11.helperWindowHandle) { if (XGetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD) == @@ -955,6 +931,30 @@ void _glfwPlatformTerminate(void) _glfw.x11.display = NULL; } + if (_glfw.x11.x11xcb.handle) + { + dlclose(_glfw.x11.x11xcb.handle); + _glfw.x11.x11xcb.handle = NULL; + } + + if (_glfw.x11.xcursor.handle) + { + dlclose(_glfw.x11.xcursor.handle); + _glfw.x11.xcursor.handle = NULL; + } + + if (_glfw.x11.randr.handle) + { + dlclose(_glfw.x11.randr.handle); + _glfw.x11.randr.handle = NULL; + } + + if (_glfw.x11.xinerama.handle) + { + dlclose(_glfw.x11.xinerama.handle); + _glfw.x11.xinerama.handle = NULL; + } + // NOTE: This needs to be done after XCloseDisplay, as libGL registers // cleanup callbacks that get called by it _glfwTerminateGLX();