[chronojump] forceSensorCaptureDoRealtimeGraphNOScroll avoids crash MoveNextRare: list is changed by other thread



commit e24ce7a707a6714150b35dc8d966390c10012d14
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Nov 16 17:35:21 2021 +0100

    forceSensorCaptureDoRealtimeGraphNOScroll avoids crash MoveNextRare: list is changed by other thread

 src/gui/app1/forceSensor.cs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/gui/app1/forceSensor.cs b/src/gui/app1/forceSensor.cs
index e36ef884c..fe70481a1 100644
--- a/src/gui/app1/forceSensor.cs
+++ b/src/gui/app1/forceSensor.cs
@@ -1814,16 +1814,16 @@ LogB.Information(" fs R ");
 
                force_capture_pixmap.DrawLines(pen_black_force_capture, paintPoints);
 
-               foreach(TriggerXForce txf in triggerXForceList)
+               //foreach(TriggerXForce txf in triggerXForceList)
+               //avoiding foreach is much better because above foreach enumeration fails when list is 
changed by other thread. "MoveNextRare" error.
+               for(int i=0 ; i < triggerXForceList.Count; i ++)
                {
+                       TriggerXForce txf = triggerXForceList[i];
                        //if already painted, do not paint it again
                        if(txf.painted)
                                continue;
 
-                       //note on realtime trigger is related to previous sample,
-                       //but on capture/analyze, trigger is related to closest sample
                        forceSensorCaptureGraphDrawTrigger (txf.trigger, txf.x, txf.force);
-
                        txf.painted = true;
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]