From e42ccc8aee05a593a87974f8963a96db35e84a6f Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 16 Feb 2020 18:38:07 +0300 Subject: [PATCH] wayland: fix deadlock in SurfaceData::cleanup (#166) --- src/wayland/compositor/tree.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wayland/compositor/tree.rs b/src/wayland/compositor/tree.rs index 19c01c5..857c3af 100644 --- a/src/wayland/compositor/tree.rs +++ b/src/wayland/compositor/tree.rs @@ -74,11 +74,12 @@ where } // orphan all our children for child in &my_data.children { - // don't do anything if this child is ourselves - if child.as_ref().equals(surface.as_ref()) { + let child_mutex = child.as_ref().user_data::>>().unwrap(); + if std::ptr::eq(child_mutex, my_data_mutex) { + // This child is ourselves, don't do anything. continue; } - let child_mutex = child.as_ref().user_data::>>().unwrap(); + let mut child_guard = child_mutex.lock().unwrap(); child_guard.parent = None; }