[chronojump] CairoGraphEncoderSignal ensures Dispose at end
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] CairoGraphEncoderSignal ensures Dispose at end
- Date: Tue, 15 Mar 2022 15:42:27 +0000 (UTC)
commit a29e7c02777791ff8b917bc4c31df49dfcf2e3e8
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Mar 15 16:41:49 2022 +0100
CairoGraphEncoderSignal ensures Dispose at end
src/gui/cairo/encoder.cs | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/src/gui/cairo/encoder.cs b/src/gui/cairo/encoder.cs
index 93fb586ba..8ab105f3f 100644
--- a/src/gui/cairo/encoder.cs
+++ b/src/gui/cairo/encoder.cs
@@ -43,16 +43,24 @@ public class CairoGraphEncoderSignal : CairoXY
points_list_inertial_painted = 0;
}
- //TODO: remove most of the null comparisons, see if we can do at start and delete graph or whatever,
but not continue all the time making comparisons
+ //separated in two methods to ensure endGraphDisposing on any return of the other method
public override void DoSendingList (string font, bool isInertial,
List<PointF> points_list, List<PointF> points_list_inertial,
bool forceRedraw, PlotTypes plotType)
{
+ if(doSendingList (font, isInertial, points_list, points_list_inertial, forceRedraw, plotType))
+ endGraphDisposing(g, surface, area.GdkWindow);
+ }
+
+ //return true if graph is inited (to dispose it)
+ private bool doSendingList (string font, bool isInertial,
+ List<PointF> points_list, List<PointF> points_list_inertial,
+ bool forceRedraw, PlotTypes plotType)
+ {
// if(doing)
-// return;
+// return false;
//doing = true;
- bool initGraphDone = false;
bool maxValuesChanged = false;
if(points_list != null)
@@ -79,7 +87,6 @@ public class CairoGraphEncoderSignal : CairoXY
)
{
initGraph( font, 1, (maxValuesChanged || forceRedraw) );
- initGraphDone = true;
points_list_painted = 0;
points_list_inertial_painted = 0;
}
@@ -90,7 +97,7 @@ public class CairoGraphEncoderSignal : CairoXY
if( points_list == null || points_list.Count == 0 ||
(isInertial && (points_list_inertial == null || points_list_inertial.Count ==
0)) )
- return;
+ return true;
g.LineWidth = 1;
pointsRadius = 1;
@@ -125,10 +132,8 @@ public class CairoGraphEncoderSignal : CairoXY
points_list_inertial_painted = points_list_inertial.Count;
}
- if(initGraphDone)
- endGraphDisposing(g, surface, area.GdkWindow);
-
//doing = false;
+ return true;
}
//based on XY findPointMaximums
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]