]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
No more actions after stopping an action context. 27/4627/2
authorReino Ruusu <reino.ruusu@semantum.fi>
Wed, 16 Dec 2020 08:31:17 +0000 (10:31 +0200)
committerReino Ruusu <reino.ruusu@semantum.fi>
Wed, 16 Dec 2020 10:37:59 +0000 (12:37 +0200)
gitlab #659

Change-Id: Ide954c322f682ff7bc9cbc53e8b5130e0294c9ce

bundles/org.simantics.simulation.sequences/src/org/simantics/simulation/sequences/action/AbstractActionContext.java

index 2adb9a045cf8a06fb525124b1a109b73f2163559..1187230ad12f4780914797193e4045ac613810ef 100644 (file)
@@ -82,6 +82,9 @@ public abstract class AbstractActionContext implements ActionContext {
     
     public double handleStep(double currentTime) {
        synchronized (this) {
+               if (stopped)
+                       return Double.POSITIVE_INFINITY;
+               
                this.currentTime = currentTime;
                {
                    ArrayList<Function1<Tuple0, Object>> temp = scheduledNow;
@@ -128,6 +131,9 @@ public abstract class AbstractActionContext implements ActionContext {
         synchronized (this) {
             List<Function1<StopReason, Object>> stopFunctions = new ArrayList<>(scheduledWhenStopped);
             scheduledWhenStopped.clear();
+            
+            scheduledNextStep.clear();
+            scheduledAt.clear();
 
             SCLContext context = SCLContext.getCurrent();
             Object oldActionContext = context.put("sequenceAction", this);