From 858bec2081451a1926c2139c59bb7be8725b4d9a Mon Sep 17 00:00:00 2001 From: Kumpelinus Date: Mon, 3 Feb 2025 20:31:32 +0100 Subject: [PATCH] Fix deadlock when changing server (#200) * Fix deadlock when changing server * remove unnecessary clones --------- Co-authored-by: mat --- azalea-client/src/packet_handling/game.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/azalea-client/src/packet_handling/game.rs b/azalea-client/src/packet_handling/game.rs index e61d401e..f8e72a4a 100644 --- a/azalea-client/src/packet_handling/game.rs +++ b/azalea-client/src/packet_handling/game.rs @@ -286,14 +286,11 @@ pub fn process_packet_events(ecs: &mut World) { Some(player_entity), ); { + let map = instance_holder.instance.read().registries.map.clone(); let new_registries = &mut weak_instance.write().registries; // add the registries from this instance to the weak instance - for (registry_name, registry) in - &instance_holder.instance.read().registries.map - { - new_registries - .map - .insert(registry_name.clone(), registry.clone()); + for (registry_name, registry) in map { + new_registries.map.insert(registry_name, registry); } } instance_holder.instance = weak_instance;