subsurface: Raise a protocol error for a bad parent. 85/244585/4
authorSeunghun Lee <shiin.lee@samsung.com>
Tue, 22 Sep 2020 04:52:01 +0000 (13:52 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Mon, 26 Oct 2020 05:50:03 +0000 (14:50 +0900)
This case should be failed noisily.

Change-Id: Id9567bdbaefa8c28378d4a7c67d895b91c7b0d5d

src/bin/e_comp_wl_subsurface.c

index e8ce3f54a4712f17baf70d1f2e808dc9f7a8c8ef..ab85fd25b20be1507b1dad9015781cca1840e4ea 100644 (file)
@@ -736,8 +736,18 @@ _e_comp_wl_subcompositor_cb_subsurface_get(struct wl_client *client EINA_UNUSED,
 
    /* try to create a new subsurface */
    if (!e_comp_wl_subsurface_create(ec, epc, id, surface_resource))
-     ERR("Failed to create subsurface for surface %d",
-         wl_resource_get_id(surface_resource));
+     {
+        if (_e_comp_wl_subsurface_circular_reference_check(ec, epc))
+          {
+             wl_resource_post_error(resource,
+                                    WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE,
+                                    "%s%d: wl_surface@%d is an ancestor of parent",
+                                    where, id, wl_resource_get_id(surface_resource));
+          }
+
+        ERR("Failed to create subsurface for surface %d",
+            wl_resource_get_id(surface_resource));
+     }
 }
 
 static const struct wl_subcompositor_interface _e_subcomp_interface =