From 251cee0bb175b6a6ed1123509bc7a54c22d3443d Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Tue, 5 Nov 2019 16:28:18 +0200 Subject: [PATCH] Node listeners were removed too soon. Listener removal caused PipeRun splits to fail synchronization to DB. As a precaution, now nodeAdded and nodeRemoved will synchronize both parent and and actual node (previously only parent node was synchronized). gitlab #35 Change-Id: I34a105cc91b8b720a48a166288610debc10a3b84 --- .../g3d/vtk/common/AbstractVTKNodeMap.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java index 2c37521b..bb5493f6 100644 --- a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java +++ b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java @@ -227,6 +227,7 @@ public abstract class AbstractVTKNodeMap implements VT } if (changeTracking) { mapping.rangeModified((E)node.getParent()); + mapping.rangeModified((E)node); } added.add(new Pair(node, id)); rangeModified = true; @@ -242,8 +243,10 @@ public abstract class AbstractVTKNodeMap implements VT if (n.first.equals(node)) return; } - if (changeTracking && !db) + if (changeTracking && !db) { + mapping.rangeModified((E)node); mapping.rangeModified((E)node.getParent()); + } removed.add(new Pair(node, id)); rangeModified = true; } @@ -438,6 +441,7 @@ public abstract class AbstractVTKNodeMap implements VT for (E n : delete) { if (DEBUG) System.out.println(debugString(n)); mapping.getRange().remove(n); + stopListening(n); } delete.clear(); } @@ -623,7 +627,6 @@ public abstract class AbstractVTKNodeMap implements VT if (DEBUG) System.out.println("Node added " + child + " parent " + node); //receiveAdd((E)child, rel ,graphUpdates); receiveAdd((E)child, rel ,graphModified.contains(node)); - } @SuppressWarnings("unchecked") @@ -634,9 +637,10 @@ public abstract class AbstractVTKNodeMap implements VT //receiveRemove((E)child, rel, graphUpdates); receiveRemove((E)child, rel, graphModified.contains(node)); - //FIXME : sometimes removed structural models cause ObjMap to add their children again. - // removing the listener here prevents corruption of visual model, but better fix is needed. - stopListening(child); + //FIXME : 1. sometimes removed structural models cause ObjMap to add their children again. + // removing the listener here prevents corruption of visual model, but better fix is needed. + // 2. detach causes nodeRemoved event, which then causes other critical events to be missed. Took out th + //stopListening(child); } @Override -- 2.47.1