From 3842b78979f7aa0f3da2447bbc7620e211a329c0 Mon Sep 17 00:00:00 2001 From: Victor Berger Date: Tue, 28 Sep 2021 16:02:58 +0200 Subject: [PATCH] wayland.compositor: fix leak of surface data The subsurface logic holds a self-reference to the WlSurface to track stacking orders of the children relative to the parent. This self-reference needs be dropped during cleanup to avoid reference cycles. This was not the case, and caused every surface user data to be leaked as it kept a reference to itself (and all of its children). --- src/wayland/compositor/tree.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wayland/compositor/tree.rs b/src/wayland/compositor/tree.rs index b2727bf..9dd7b7e 100644 --- a/src/wayland/compositor/tree.rs +++ b/src/wayland/compositor/tree.rs @@ -112,7 +112,7 @@ impl PrivateSurfaceData { .retain(|c| !c.as_ref().equals(surface.as_ref())); } // orphan all our children - for child in &my_data.children { + for child in my_data.children.drain(..) { let child_mutex = child .as_ref() .user_data()