This is an automated email from the git hooks/post-receive script.

git pushed a commit to reference refs/pull/292/head
in repository efl.

View the commit online.

commit afa00f6a083fae86187ea20beab7e7de8e4984d1
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Dec 2 21:13:35 2026 -0600

    evas:wayland_egl: do not leave EGL_PLATFORM set in the environment
    
    On an EGL without the platform extensions, the engine steers
    eglGetDisplay() with EGL_PLATFORM=wayland and left it set. Every
    process the application then starts inherits it, and one that calls
    eglGetDisplay() on an X11 or GBM display has it taken for a
    wl_display.
    
    Set it around that one call and put back whatever was there before,
    as gl_drm now does. Mesa reads the variable once, in the first
    eglGetDisplay(), so nothing later depends on it staying set.
    
    Not covered by a test: no EGL at hand lacks the platform extensions,
    so this path cannot be reached here.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../evas/engines/wayland_egl/evas_wl_main.c        | 25 ++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/modules/evas/engines/wayland_egl/evas_wl_main.c b/src/modules/evas/engines/wayland_egl/evas_wl_main.c
index f3cbb4ad87..b8ba686d57 100644
--- a/src/modules/evas/engines/wayland_egl/evas_wl_main.c
+++ b/src/modules/evas/engines/wayland_egl/evas_wl_main.c
@@ -8,6 +8,26 @@ static EGLContext context = EGL_NO_CONTEXT;
 static struct wl_display *display = NULL;
 static int win_count = 0;
 
+/* Legacy path for stacks predating the platform extensions:
+ * eglGetDisplay() only knows its argument is a wl_display from
+ * EGL_PLATFORM. Mesa reads it once, there, and anything left set is
+ * inherited by every process this one starts. */
+static EGLDisplay
+_eng_legacy_egl_display_get(struct wl_display *wl_disp)
+{
+   char *platform_env = eina_strdup(getenv("EGL_PLATFORM"));
+   EGLDisplay disp;
+
+   setenv("EGL_PLATFORM", "wayland", 1);
+   disp = eglGetDisplay((EGLNativeDisplayType)wl_disp);
+   if (platform_env)
+     setenv("EGL_PLATFORM", platform_env, 1);
+   else
+     unsetenv("EGL_PLATFORM");
+   free(platform_env);
+   return disp;
+}
+
 Outbuf *
 eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Output_Swap_Mode swap_mode)
 {
@@ -64,10 +84,7 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Output_Swap
    else
      {
 noext:
-        /* Legacy path for stacks predating the platform extensions, where
-         * eglGetDisplay() has to be steered by the environment. */
-        setenv("EGL_PLATFORM", "wayland", 1);
-        gw->egl_disp = eglGetDisplay((EGLNativeDisplayType)wl_disp);
+        gw->egl_disp = _eng_legacy_egl_display_get(wl_disp);
      }
    if (!gw->egl_disp)
      {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to