Commit 06814a92 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Check for subsurface loops

If subsurfaces form a loop, kwin will get stuck in an infinite
recursion while it constructs a window pixmap tree.
parent 729601ba
......@@ -50,6 +50,19 @@ void SubCompositorInterfacePrivate::subcompositor_get_subsurface(Resource *resou
return;
}
if (surface == parent) {
wl_resource_post_error(resource->handle, error_bad_surface,
"wl_surface@%d cannot be its own parent",
wl_resource_get_id(surface_resource));
return;
}
if (parent->subSurface() && parent->subSurface()->mainSurface() == surface) {
wl_resource_post_error(resource->handle, error_bad_surface,
"wl_surface@%d is an ancestor of parent",
wl_resource_get_id(surface_resource));
return;
}
wl_resource *subsurfaceResource = wl_resource_create(resource->client(), &wl_subsurface_interface,
resource->version(), id);
if (!subsurfaceResource) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment