From a793f27f514c0b6b53fd29210d1793178222c8c0 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Mon, 22 Jan 2024 14:07:46 +0100 Subject: [PATCH] [#2435] Copy stageMap instead of directly referencing it This change is to ensure that the stageMap property of the Rocket class is isolated from its source object. Previously, it directly referenced the stageMap of the source, but now we create an entirely new ConcurrentHashMap to hold those stages. This will prevent possible conflicts and unwanted modifications to the source stageMap. --- core/src/net/sf/openrocket/rocketcomponent/Rocket.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java index 1824934bc..1f547cdb1 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java +++ b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java @@ -433,7 +433,7 @@ public class Rocket extends ComponentAssembly { this.functionalModID = source.functionalModID; this.refType = source.refType; this.customReferenceLength = source.customReferenceLength; - this.stageMap = source.stageMap; + this.stageMap = new ConcurrentHashMap<>(source.stageMap); // these flight configurations need to reference the _this_ Rocket: this.configSet.reset();