[chronojump] Fixed crash on raceAnalyzer capture after 2.2.1



commit 5258512b43325091b419af71fddc54b7bd1d981b
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Apr 26 16:58:27 2022 +0200

    Fixed crash on raceAnalyzer capture after 2.2.1

 src/gui/cairo/raceAnalyzer.cs | 9 +++++++--
 src/gui/cairo/xy.cs           | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/cairo/raceAnalyzer.cs b/src/gui/cairo/raceAnalyzer.cs
index bf5f955ca..60cc9964e 100644
--- a/src/gui/cairo/raceAnalyzer.cs
+++ b/src/gui/cairo/raceAnalyzer.cs
@@ -87,15 +87,20 @@ public class CairoGraphRaceAnalyzer : CairoXY
                if(points_list != null)
                        maxValuesChanged = findPointMaximums(false, points_list);
 
+               bool graphInited = false;
                if(maxValuesChanged || forceRedraw || points_list.Count != points_list_painted)
                {
                        initGraph( font, 1, (maxValuesChanged || forceRedraw) );
+                       graphInited = true;
                        points_list_painted = 0;
                }
                if(points_list == null || points_list.Count == 0)
                {
+                       if(! graphInited)
+                               initGraph( font, 1, (maxValuesChanged || forceRedraw) );
+
                        paintAxis();
-                       return true;
+                       return graphInited;
                }
 
                if(maxValuesChanged || forceRedraw)
@@ -205,7 +210,7 @@ public class CairoGraphRaceAnalyzer : CairoXY
                                paintVerticalTriggerLine(g, trigger, textHeight -3);
 
                //doing = false;
-               return true;
+               return graphInited;
        }
 
        protected override void printYAxisText()
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index 8380d1c69..bef710757 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -563,7 +563,7 @@ public abstract class CairoXY : CairoGeneric
        protected void writeCoordinatesOfMouseClick(double graphX, double graphY, double realX, double realY)
        {
                // 1) need to do this because context has been disposed
-               LogB.Information(string.Format("g == null: {0}", (g = null)));
+               LogB.Information(string.Format("g == null: {0}", (g == null)));
                if(g == null)
                        g = Gdk.CairoHelper.Create (area.GdkWindow); //area->surface does not work
 


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