]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fix MappingBase to update and invalidate configurationByComponentId
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 21 Jan 2022 19:43:40 +0000 (21:43 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 24 Jan 2022 13:15:55 +0000 (15:15 +0200)
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)

bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/MappingBase.java

index e9185e6393246bb1c7ae6ff606b5cbcb2fdfca71..4dda1f3af18b65388d087f29743941a51bdb74f3 100644 (file)
@@ -175,6 +175,7 @@ abstract public class MappingBase<T extends ComponentBase<T>> {
             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<T extends ComponentBase<T>> {
             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<T>() {
                 @Override
@@ -299,6 +302,10 @@ abstract public class MappingBase<T extends ComponentBase<T>> {
             configurationBySolverName.clear();
             configurationBySolverName = null;
         }
+        if (configurationByComponentId != null) {
+            configurationByComponentId.clear();
+            configurationByComponentId = null;
+        }
         pendingRemoval.clear();
     }