add check whether subsurface parent relationship is cycle
authorSungBae, Park <sb34.park@samsung.com>
Fri, 25 Mar 2016 09:18:49 +0000 (18:18 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Tue, 29 Mar 2016 12:41:23 +0000 (21:41 +0900)
Signed-off-by: SungBae, Park <sb34.park@samsung.com>
Change-Id: I3e48fa72830dce7b91902f958578c10ad894a35e

src/bin/e_comp_wl.c

index 76c5d097c184b95514371ad4bf589336bd8df727..92ef9df3e8c5412a51bf57fff47223072b67a13e 100644 (file)
@@ -3237,6 +3237,28 @@ e_comp_wl_subsurface_create(E_Client *ec, E_Client *epc, uint32_t id, struct wl_
         return EINA_FALSE;
      }
 
+   // check parent relationship is a cycle
+     {
+        E_Client *parent = epc;
+
+        while(parent)
+          {
+             if (ec == parent)
+               {
+                  ERR("Subsurface parent relationship is a cycle : [child win : %x, %s], [parent win : %x, %s]",
+                      e_client_util_win_get(ec), e_client_util_name_get(ec),
+                      e_client_util_win_get(epc), e_client_util_name_get(epc));
+
+                  return EINA_FALSE;
+               }
+
+             if (parent->comp_data->sub.data)
+                parent = parent->comp_data->sub.data->parent;
+             else
+                break;
+          }
+     }
+
    /* try to allocate subsurface data */
    if (!(sdata = E_NEW(E_Comp_Wl_Subsurf_Data, 1)))
      {