From 525ad7bfb8884b7cf497bc8e6ebf743df0dada8c Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 29 Jan 2018 04:55:55 +0100 Subject: [PATCH] Close the libwayland-cursor handle after destroying the cursor theme Fixes a segfault on glfwTerminate(). --- src/wl_init.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c index 7d61110e..f594eac9 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -827,39 +827,38 @@ int _glfwPlatformInit(void) void _glfwPlatformTerminate(void) { - _glfwTerminateEGL(); _glfwTerminateJoysticksLinux(); + _glfwTerminateEGL(); + if (_glfw.wl.egl.handle) + { + _glfw_dlclose(_glfw.wl.egl.handle); + _glfw.wl.egl.handle = NULL; + } #ifdef HAVE_XKBCOMMON_COMPOSE_H if (_glfw.wl.xkb.composeState) xkb_compose_state_unref(_glfw.wl.xkb.composeState); #endif - if (_glfw.wl.xkb.keymap) xkb_keymap_unref(_glfw.wl.xkb.keymap); if (_glfw.wl.xkb.state) xkb_state_unref(_glfw.wl.xkb.state); if (_glfw.wl.xkb.context) xkb_context_unref(_glfw.wl.xkb.context); - if (_glfw.wl.xkb.handle) { _glfw_dlclose(_glfw.wl.xkb.handle); _glfw.wl.xkb.handle = NULL; } - if (_glfw.wl.egl.handle) - { - _glfw_dlclose(_glfw.wl.egl.handle); - _glfw.wl.egl.handle = NULL; - } + + if (_glfw.wl.cursorTheme) + wl_cursor_theme_destroy(_glfw.wl.cursorTheme); if (_glfw.wl.cursor.handle) { _glfw_dlclose(_glfw.wl.cursor.handle); _glfw.wl.cursor.handle = NULL; } - if (_glfw.wl.cursorTheme) - wl_cursor_theme_destroy(_glfw.wl.cursorTheme); if (_glfw.wl.cursorSurface) wl_surface_destroy(_glfw.wl.cursorSurface); if (_glfw.wl.compositor)