Преглед изворни кода

Merge pull request #9195 from jakesmith/hpcc-16387

HPCC-16387 Fix issue with unstarted conditionals

Reviewed-By: Gavin Halliday <gavin.halliday@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman пре 8 година
родитељ
комит
5e2070ff61
1 измењених фајлова са 12 додато и 6 уклоњено
  1. 12 6
      thorlcr/activities/loop/thloopslave.cpp

+ 12 - 6
thorlcr/activities/loop/thloopslave.cpp

@@ -794,6 +794,14 @@ class CConditionalActivity : public CSlaveActivity
     IThorDataLink *selectedItdl = nullptr;
     IEngineRowStream *selectedInputStream = nullptr;
 
+    void stopUnselectedInputs()
+    {
+        ForEachItemIn(i, inputs)
+        {
+            if (i != branch)
+                stopInput(i);
+        }
+    }
 protected:
     unsigned branch = (unsigned)-1;
 
@@ -805,11 +813,7 @@ public:
     virtual void start() override
     {
         ActivityTimer s(totalCycles, timeActivities);
-        ForEachItemIn(i, inputs)
-        {
-            if (i != branch)
-                stopInput(i);
-        }
+        stopUnselectedInputs();
         if (queryInput(branch))
         {
             startInput(branch);
@@ -821,7 +825,9 @@ public:
     }
     virtual void stop() override
     {
-        if ((branch>0) && queryInput(branch)) // branch 0 stopped by PARENT::stop
+        if (!hasStarted())
+            stopUnselectedInputs(); // i.e. all
+        else if ((branch>0) && queryInput(branch)) // branch 0 stopped by PARENT::stop
             stopInput(branch);
         selectedInputStream = NULL;
         abortSoon = true;