diff --git a/src/PamguardMVC/PamDataBlock.java b/src/PamguardMVC/PamDataBlock.java index 97236384..28ce0e07 100644 --- a/src/PamguardMVC/PamDataBlock.java +++ b/src/PamguardMVC/PamDataBlock.java @@ -987,6 +987,23 @@ public class PamDataBlock extends PamObservable { } } } + + public void clearAll(boolean andDownStream) { + clearAll(); + if (andDownStream) { + int nObs = countObservers(); + for (int i = 0; i < nObs; i++) { + PamObserver obs = getPamObserver(i); + if (obs instanceof PamProcess) { + PamProcess proc = (PamProcess) obs; + ArrayList procOuts = proc.getOutputDataBlocks(); + for (PamDataBlock b : procOuts) { + b.clearAll(andDownStream); + } + } + } + } + } /** * Reset a datablock. This is called at PamStart from PamController It's been diff --git a/src/offlineProcessing/OfflineTaskGroup.java b/src/offlineProcessing/OfflineTaskGroup.java index 7ad4fe41..fd1a4401 100644 --- a/src/offlineProcessing/OfflineTaskGroup.java +++ b/src/offlineProcessing/OfflineTaskGroup.java @@ -676,9 +676,11 @@ public class OfflineTaskGroup implements PamSettings { */ /** - * Now process the data + * Now process the data. Copy to preserve data integrity. */ - it = primaryDataBlock.getListIterator(0); + ArrayList dataCopy = primaryDataBlock.getDataCopy(); + it = dataCopy.listIterator(); + unitChanged = false; int totalUnits = 0; int unitsChanged = 0;