From bc2dcdf9db38c95c10532133274a4666c6d0bf4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20K=C3=B6nig?= Date: Wed, 28 Oct 2020 18:57:37 +0100 Subject: [PATCH] wl: Fix destroying CSDs in correct order (#3051) On Wayland, some compositors refuse to implement SSDs in which case we draw primitive CSDs. However, the destructors were called in the wrong order, leading to a dereference of an already freed object. --- glfw/wl_window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glfw/wl_window.c b/glfw/wl_window.c index 735590a45..90e9f1ae1 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -413,10 +413,10 @@ static void createDecorations(_GLFWwindow* window) static void destroyDecoration(_GLFWdecorationWayland* decoration) { - if (decoration->surface) - wl_surface_destroy(decoration->surface); if (decoration->subsurface) wl_subsurface_destroy(decoration->subsurface); + if (decoration->surface) + wl_surface_destroy(decoration->surface); if (decoration->viewport) wp_viewport_destroy(decoration->viewport); decoration->surface = NULL;