From 3d235b8da626f4f963b59abae8d117538005d87b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= Date: Sun, 29 Oct 2023 22:41:53 +0000 Subject: [PATCH] Clean up Wayland resources on wxGLCanvas destructor If the wxGLCanvas is destroyed immediately (without hiding it first), the GTKs widget's `unmap` signal which usually destroys the Wayland resources is not emitted. Thus, we need to ensure they are destroyed on the destructor instead. This fixes an use-after-free issue, sometimes causing a crash, because one of the leaked resources is the canvas's Wayland frame callback. See #24013, #24016. (cherry picked from commit 22ae7a58b5412463194b446426296b588368bff8) --- src/unix/glegl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/glegl.cpp b/src/unix/glegl.cpp index a96016e6a8..25cf9a0655 100644 --- a/src/unix/glegl.cpp +++ b/src/unix/glegl.cpp @@ -630,6 +630,7 @@ wxGLCanvasEGL::~wxGLCanvasEGL() if ( m_surface ) eglDestroySurface(m_display, m_surface); #ifdef GDK_WINDOWING_WAYLAND + DestroyWaylandSubsurface(); g_clear_pointer(&m_wlEGLWindow, wl_egl_window_destroy); g_clear_pointer(&m_wlSurface, wl_surface_destroy);