Skip to content

Commit 977187f

Browse files
wirew0rmRalphSteinhagen
authored andcommitted
OszilloscopeAxis: guard against range computation infinite loop
only recompute the range once per iteration. This prevents an infinite range computation loop caused by the tick mark computation needed by the range computation and calling the range compuation itself to compute the ticks.
1 parent a09b08c commit 977187f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

chartfx-chart/src/main/java/io/fair_acc/chartfx/axes/spi/OscilloscopeAxis.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public class OscilloscopeAxis extends AbstractAxis implements Axis {
5555
private final StyleableDoubleProperty axisZeroValue = CSS.createDoubleProperty(this, "axisZeroValue", 0.0, true, null, this::requestAxisLayout);
5656
private final transient Cache cache = new Cache();
5757
protected boolean isUpdating;
58+
private boolean computingRange = false;
5859

5960
/**
6061
* Creates an {@link #autoRangingProperty() auto-ranging} Axis.
@@ -164,7 +165,11 @@ public double getAxisZeroValue() {
164165
* @return the range that is clamped to limits defined by {@link #getMinRange()} and {@link #getMaxRange()}.
165166
*/
166167
public DataRange getClampedRange() {
167-
recomputeClampedRange();
168+
if (!computingRange) { // guard against infinite range computation loop
169+
computingRange = true;
170+
recomputeClampedRange();
171+
computingRange = false;
172+
}
168173
return clampedRange;
169174
}
170175

0 commit comments

Comments
 (0)