Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions core/src/display_object/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,20 @@ impl<'gc> ChildContainer<'gc> {
/// if no list alterations were made.
fn remove_child_from_depth_list(&mut self, child: DisplayObject<'gc>) -> bool {
if let Some(other_child) = self.depth_list.get(&child.depth()) {
DisplayObject::ptr_eq(*other_child, child)
&& self.depth_list.remove(&child.depth()).is_some()
} else {
false
return DisplayObject::ptr_eq(*other_child, child)
&& self.depth_list.remove(&child.depth()).is_some();
}

// Hack to remove child from depth list by value if previous fast lookup didn't work.
if let Some((&depth, _)) = self
.depth_list
.iter()
.find(|(_, obj)| DisplayObject::ptr_eq(**obj, child))
{
return self.depth_list.remove(&depth).is_some();
}

false
}

/// Remove a child from the render list.
Expand Down