summaryrefslogtreecommitdiff
path: root/academic/scidavis/fix-sf385-crash-using-data-range-selector.patch
blob: ba062d2e2866c44e2780166f5cad0c7df4a62619 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff --git a/libscidavis/src/RangeSelectorTool.cpp b/libscidavis/src/RangeSelectorTool.cpp
index 26ce5fd..65bfa54 100644
--- a/libscidavis/src/RangeSelectorTool.cpp
+++ b/libscidavis/src/RangeSelectorTool.cpp
@@ -115,8 +115,8 @@ void RangeSelectorTool::pointSelected(const QPoint &pos)
 		setActivePoint(point);
 	else {
 		// try to be intelligent about selecting the inactive point
-		double min_x = curve->minXValue();
-		double max_x = curve->maxXValue();
+		double min_x = minXValue();
+		double max_x = maxXValue();
 		int n = curve->dataSize();
 		double second_x;
 		if (curve->x(point) == min_x)
@@ -129,11 +129,11 @@ void RangeSelectorTool::pointSelected(const QPoint &pos)
 			second_x = min_x;
 		if (second_x == max_x) { // start at selected point and try larger indices first
 			for (int i=0; i<n; ++i)
-				if (curve->x((i + point) % n) == max_x)
+				if (qFuzzyCompare(curve->x((i + point) % n), max_x))
 					d_inactive_point = (i + point) % n;
 		} else { // start at selected point and try smaller indices first
 			for (int i=n-1; i>=0; --i)
-				if (curve->x((i + point) % n) == max_x)
+				if (qFuzzyCompare(curve->x((i + point) % n),max_x))
 					d_inactive_point = (i + point) % n;
 		}
 		d_selected_curve = curve;