From a62b29135380fe46eaa06307ffe3722506f357e1 Mon Sep 17 00:00:00 2001 From: Florian Larysch Date: Fri, 3 Apr 2026 21:39:43 +0200 Subject: [PATCH] Fix eglDestroySurface() argument order when using EGL with X11 eglDestroySurface takes the display first and the surface second rather than the other way around. Since both EGLDisplay and EGLSurface are just typedef'd to void* this doesn't raise a compiler warning. This currently doesn't crash at runtime because Mesa validates the display pointer against a list of known good values and fails gracefully, but it still causes a resource leak. The wrong call was present since the changes of 23ccdb2 (Improve and document wxGLCanvas::CreateSurface(), 2023-03-21), see #23366. Closes #26341. --- src/unix/glegl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/glegl.cpp b/src/unix/glegl.cpp index fc53bfcc2a..8ec9bab1b1 100644 --- a/src/unix/glegl.cpp +++ b/src/unix/glegl.cpp @@ -611,7 +611,7 @@ void wxGLCanvasEGL::OnRealized() { if ( m_surface != EGL_NO_SURFACE ) { - eglDestroySurface(m_surface, m_display); + eglDestroySurface(m_display, m_surface); m_surface = EGL_NO_SURFACE; }