GalaevAlexey / core-plot

Automatically exported from code.google.com/p/core-plot
0 stars 0 forks source link

Momentum: crash when simply tapping on the chart without dragging #585

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Enable momentum scrolling on a CPTXYPlotSpace (allowsMomentum = YES)

2. Tap on the chart without dragging

3. Observe an assertion failure in [_CPTConstraintsFixed 
positionForLowerBound:upperBound] at line 79: lowerBound and upperBound are NaN.

What version of the product are you using? On what operating system?

CorePlot 1.3 on iOS 6 and 7

Please provide any additional information below.

I am unable to reproduce this issue in every chart, and I haven't been able to 
isolate the specific set of conditions that need to be met for this bug to 
occur.

However, I have traced back its origin to [CPTXYPlotSpace 
pointingDeviceUpEvent:atPoint], line 1061:

CGFloat speed = sqrt(displacement.x * displacement.x + displacement.y * 
displacement.y) / CPTFloat(self.lastDeltaTime);

In the problematic situation, self.lastDeltaTime is 0.0, leading to a division 
by zero leading to a speed of NaN. This NaN value is then propagated up to the 
code that handles the actual shifting/scrolling. Also, displacement is (0,0).

Even though the exact conditions required to reproduce this bug are not fully 
understood, it would still be a good idea to prevent the division by zero and 
even to check for a 0,0 displacement before executing the momentum scrolling 
code, as there is no point in going down that codepath if I haven't scrolled at 
all.

Original issue reported on code.google.com by pascal.b...@gmail.com on 27 Sep 2013 at 3:51

GoogleCodeExporter commented 8 years ago
This issue was closed by revision ce790d48a16b.

Original comment by eskr...@mac.com on 28 Sep 2013 at 2:43