From: Tuukka Lehtonen Date: Fri, 21 Jan 2022 19:43:40 +0000 (+0200) Subject: Fix MappingBase to update and invalidate configurationByComponentId X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=55c756595b16f2374bfb553542d208f13114a81d;p=simantics%2Fplatform.git Fix MappingBase to update and invalidate configurationByComponentId Previous changes made in #713 only added the cache structure but failed to update and invalidate when synchronization is performed and the structure is updated. gitlab #798 (cherry picked from commit bbdf2b95e12b65225ba1888e090801dd9421a9da) --- diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/MappingBase.java b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/MappingBase.java index e9185e639..4dda1f3af 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/MappingBase.java +++ b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/MappingBase.java @@ -175,6 +175,7 @@ abstract public class MappingBase> { result = componentFactory.create(uid); configurationByUid.put(uid, result); configurationBySolverName = null; // forces recalculation + configurationByComponentId = null; // forces recalculation } else { if(result.getParent() == null) @@ -223,6 +224,8 @@ abstract public class MappingBase> { configurationByUid.remove(component.uid); if (configurationBySolverName != null && component.solverComponentName != null) configurationBySolverName.remove(component.solverComponentName); + if (configurationByComponentId != null && component.componentId != 0) + configurationByComponentId.remove(component.componentId); if(component.getChildMap() != null) component.getChildMap().forEachValue(new TObjectProcedure() { @Override @@ -299,6 +302,10 @@ abstract public class MappingBase> { configurationBySolverName.clear(); configurationBySolverName = null; } + if (configurationByComponentId != null) { + configurationByComponentId.clear(); + configurationByComponentId = null; + } pendingRemoval.clear(); }