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

git pushed a commit to branch up/subsurface-restack
in repository enlightenment.

View the commit online.

commit 04d8b763f74abe9c5fa2b514834487776079fe64
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 28 16:47:23 2026 -0600

    e_comp_wl - a null buffer is not attached before the configure
    
    xdg_surface's unconfigured_buffer error is for a buffer attached
    before the surface has been configured, as it would map a surface the
    compositor has not sized yet. E raised it for any wl_surface.attach
    while it waited for the configure, a null buffer included. A client
    that attaches a null buffer to a toplevel it already unmapped, as it
    does when it hides a window that is hidden, was disconnected.
    
    A null buffer maps nothing and is not checked any more. wlroots checks
    the same way.
    
    wl-remap unmaps a toplevel with a null buffer, then attaches a null
    buffer again; that is a protocol error without this.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/bin/e_comp_wl.c            |  3 ++-
 src/tests/wayland/meson.build  |  1 +
 src/tests/wayland/test_remap.c | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index 8d2aff06f..e5d1908fc 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -2248,7 +2248,8 @@ _e_comp_wl_surface_cb_attach(struct wl_client *client, struct wl_resource *resou
 
    if (!(ec = wl_resource_get_user_data(resource))) return;
    if (e_object_is_del(E_OBJECT(ec))) return;
-   if (ec->comp_data->need_xdg_configure)
+   /* A null buffer maps nothing, and an unmapped surface may attach one. */
+   if ((buffer_resource) && (ec->comp_data->need_xdg_configure))
      {
 #ifdef E_TESTS
         if (!_e_comp_wl_test_stand_in_for_initial_commit(ec))
diff --git a/src/tests/wayland/meson.build b/src/tests/wayland/meson.build
index 6f0ac3f69..661c39ee5 100644
--- a/src/tests/wayland/meson.build
+++ b/src/tests/wayland/meson.build
@@ -80,6 +80,7 @@ wl_protocol_tests = [
   ['subsurface-position', 'test_subsurface_position.c'],
   ['subsurface-input', 'test_subsurface_input.c'],
   ['window-geometry', 'test_window_geometry.c'],
+  ['remap', 'test_remap.c'],
   ['configure-size', 'test_configure_size.c'],
   ['touch-moving-surface', 'test_touch_moving_surface.c'],
   ['pointer-axis120', 'test_pointer_axis120.c'],
diff --git a/src/tests/wayland/test_remap.c b/src/tests/wayland/test_remap.c
new file mode 100644
index 000000000..028104aeb
--- /dev/null
+++ b/src/tests/wayland/test_remap.c
@@ -0,0 +1,35 @@
+/* A toplevel unmapped by a null buffer may attach a null buffer again: it
+ * maps nothing, so it is not a buffer attached before the configure. */
+#include <stdio.h>
+
+#include "e_wl_testkit.h"
+
+#define PROG "test-remap"
+#define APP_ID "e.test.remap"
+
+int
+main(void)
+{
+   Tk_Toplevel *top;
+   struct wl_surface *surface;
+   Tk *tk;
+
+   tk = tk_connect(PROG);
+   top = tk_toplevel_new(tk, APP_ID, PROG, 200, 100);
+   surface = tk_toplevel_surface(top);
+
+   wl_surface_attach(surface, NULL, 0, 0);
+   wl_surface_commit(surface);
+   tk_settle(tk);
+   wl_surface_attach(surface, NULL, 0, 0);
+   wl_surface_commit(surface);
+   if (tk_protocol_error(tk, NULL) >= 0)
+     {
+        fprintf(stderr, PROG ": a null buffer attached while unmapped is an error\n");
+        return 1;
+     }
+
+   tk_disconnect(tk);
+   printf(PROG ": ok\n");
+   return 0;
+}

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

Reply via email to