Recent

Author Topic: Crash in TBarSeries.Extent  (Read 630 times)

piola

  • New Member
  • *
  • Posts: 46
Crash in TBarSeries.Extent
« on: November 03, 2019, 06:51:46 am »
I stumbled upon a bug in TBarSeries.

Steps to reproduce:
1. Create a new TBarSeries bs1 (at runtime)
2. Add some x/y data to it
3. Calling bs1.MinXValue (and similar) as long as the series is not assigned to a chart causes a segfault.

Suggestion:

In "TBarSeries.Extent: TDoubleRect", change the second line (should be line 1519) to

if IsEmpty or not Assigned(FChart) then exit;

This way, the x-range does not take into account that the first and last bar should be fully visible, but it just returns the data's x-min and x-max without causing a crash.

wp

  • Hero Member
  • *****
  • Posts: 7384
Re: Crash in TBarSeries.Extent
« Reply #1 on: November 03, 2019, 11:27:12 am »
I think this is an error condition, and an exception is ok to tell the programmer that he did something wrong. Showing only part of the first and last bars is certainly an error, too, which will be reported by somebody else who does not know about the background.

In the new revision r62162, an EChartError exception is raised with a better error message.

If you really need the extent of the data shown in the BarSeries *BEFORE* the series is added to the chart you should call BarSeries.Source.Extent.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

piola

  • New Member
  • *
  • Posts: 46
Re: Crash in TBarSeries.Extent
« Reply #2 on: November 03, 2019, 12:17:13 pm »
If you really need the extent of the data shown in the BarSeries *BEFORE* the series is added to the chart you should call BarSeries.Source.Extent.

Ok, I understand. Thank you very much.

 

TinyPortal © 2005-2018