epc = e_pixmap_find_client_by_res_id(parent_id);
+ /* This check code is for detecting an error case which tries to create
+ * sub-surface relationship with invalid parent. */
+ if ((epc) &&
+ (!e_object_is_del(E_OBJECT(epc))) &&
+ (!epc->comp_data))
+ {
+ /* Another error case is handled by e_comp_wl_subsurface_create()
+ * at the time this code is written. */
+ ELOGF("TZPOL", "Parent(%p internal? %s) doesn't have comp_data. "
+ "Possibly it's not the surface created by client. "
+ "Cannot be the parent of sub-surface.",
+ ec, epc, epc->internal ? "TRUE" : "FALSE");
+ wl_resource_post_error(resource,
+ WL_SUBSURFACE_ERROR_BAD_SURFACE,
+ "Invalid parent_id@%d. Possibly it's not the "
+ "surface created by client.(internal? %s) "
+ "Cannot be the parent of sub-surface.",
+ parent_id, epc->internal ? "TRUE" : "FALSE");
+ return;
+ }
+
/* try to create a new subsurface */
if (!e_comp_wl_subsurface_create(ec, epc, id, surface))
{