Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1293

Summary: TCustomGauge: Access violation when streaming
Product: VCL TeeChart Reporter: LNS <linus.hogrebe>
Component: SeriesAssignee: Steema Issue Manager <issuemanager>
Status: CONFIRMED ---    
Severity: normal CC: sandra
Priority: ---    
Version: 150420   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version: RAD XE5
Attachments: Example Project
Example Project (corrected)

Description LNS 2015-09-07 11:05:20 EDT
When trying to save a chart with a knob gauge after clearing the series, an access violation occurs when trying to access the value (= MandatoryValueList[0]).

See attached example.
Comment 1 LNS 2015-09-07 11:06:01 EDT
Created attachment 494 [details]
Example Project
Comment 2 sandra pazos 2015-09-18 04:40:23 EDT
*** Bug 1292 has been marked as a duplicate of this bug. ***
Comment 3 sandra pazos 2015-09-18 05:52:45 EDT
Hello Lns, 

In the example project you attached here, there isn't any Knob Gauge. Moreover, using the code below the problem doesn’t occur for us with latest TeeChart Pro VCL/FMX 2015 published

procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.Clear;
Series1.FillSampleValues(20);
end;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
Self.Text := FloatToStr(Series1.MandatoryValueList[0]);
end;

Could you please change the code above, because we can reproduce the problem you are experiencing?
Comment 4 LNS 2015-09-18 06:37:53 EDT
Created attachment 502 [details]
Example Project (corrected)
Comment 5 LNS 2015-09-18 06:47:22 EDT
Hi Sandra,

I apologize for the mess with the corrupted example project and the duplicate issue (1292 & 1293). I had some problems filing the bug and this seems to have lead to the duplicate entries.

I attached a corrected version of the test case that should now include a simple but complete delphi project.

The problem occurs when trying to save a chart (including a TCustomGauge series) after having cleared its values. The problem originates from the GetValue method where no check is being performed on the list count. 
We solved this using a workaround for our TCustomGauge descendant by reintroducing GetValue and using the code from TGaugeSeries.GetValue (that adds "if Count=0 then Add(0)"). So my proposal would be to include that in the original TCustomGauge.GetValue. Or - from my POV even better - change it e.g. to:

function TCustomGauge.GetValue:TChartValue;
begin
  if MandatoryValueList.Count = 0 then
    result := 0
  else
    result:=MandatoryValueList[0];
end;

Kind regards,
Linus