diff --git a/README.md b/README.md index a23d146b..ed88f277 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ information on what to include when reporting a bug. ## Changelog + - [Wayland] Bugfix: Terminating the library before showing a window could segfault - [Linux] Bugfix: `regfree´ was called on invalid data (#2464) diff --git a/src/wl_init.c b/src/wl_init.c index bc786677..f66c63a7 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -637,10 +637,15 @@ void _glfwPlatformTerminate(void) _glfwTerminateEGL(); _glfwTerminateOSMesa(); - if (_glfw.wl.libdecor.callback) - wl_callback_destroy(_glfw.wl.libdecor.callback); if (_glfw.wl.libdecor.context) + { + // Allow libdecor to finish receiving all its requested globals + // and ensure the associated sync callback object is destroyed + while (!_glfw.wl.libdecor.ready) + _glfwPlatformWaitEvents(); + libdecor_unref(_glfw.wl.libdecor.context); + } if (_glfw.wl.libdecor.handle) {